天天看点

AndroidShell (Mac Os Commands)AndroidShell (Mac Os Commands)

<a href="#sha1">__sha-1__</a>

<a href="#debug_keystore">__debug keystore__</a>

<a href="#release_keystore">__release keystore__</a>

<a href="#adb">__adb__</a>

<a href="#show_cold_start_activity_time">__show cold start activity time__</a>

<a href="#database">__database__</a>

<a href="#watching_strictmode">__watching strictmode__</a>

<a href="#view_connected_devices">__view connected devices__</a>

<a href="#list_running_services">__list of running services__</a>

<a href="#install_application">__install an application__</a>

<a href="#uninstall_application">__uninstall an application__</a>

<a href="#start_activity">__start an activity__</a>

<a href="#open_deep_linking_intent">__open a deep linking intent__</a>

<a href="#take_screenshot">__take an screenshot__</a>

<a href="#power_button">__power button__</a>

<a href="#unlock_screen">__unlock screen__</a>

<a href="#print_installed_packages">__print all installed packages__</a>

<a href="#path_application">__get the path of an installed application__</a>

<a href="#simulate_application_being_killed">__simulate application being killed__</a>

<a href="#screen_recording_using_4_4">__screen recording using android 4.4__</a>

<a href="#check_battery_stats">__check battery stats__</a>

<a href="#auto_backup_data_android_m">__auto backup data (only in android m)__</a>

<a href="#simulate_fingerprint_inputs_android_m">__simulate fingerprint inputs (only in android m)__</a>

<a href="#filter_tagname_logcat">__filter by tagname in logcat__</a>

<a href="#filter_priority_logcat">__filter by priority in logcat__</a>

<a href="#filter_using_grep_logcat">__filter using grep in logcat__</a>

<a href="#see_executed_sql_statements_plain_text_logcat">__see the executed sql statements in plain text in logcat__</a>

<a href="#execute_monkey_test_user_interaction">__testing - execute monkey to test user interaction__</a>

<a href="#find_out_processor_version_android">__find out processor version on android device (check if it's an arm, for example)__</a>

<a href="#test-alarms">test alarms</a>

<a href="#query-a-content-provider">query a content provider</a>

<a href="#find_out_abi">__find out application binary interface (abi) in different devices__</a>

<a href="#retrieve_app_private_data_and_db_without_root">__retrieve application's private data and databases for non debug application without root access__</a>

<a href="#identify_frame_rate_issues">__indentify frame rate issues (dumpsys)__</a>

<a href="#adb_over_wifi">__use adb over wi-fi without extra application or software__</a>

<a href="#test_new_marshmallow_permissions">__test new marshmallow permissions__</a>

<a href="#test_app_with_app_standby">__testing your app with app standby__</a>

<a href="#test_app_doze">__testing your app with doze__</a>

<a href="#enabling_night_mode_android_nougat">__enabling night mode on android nougat__</a>

<a href="#aapt">__aapt__</a>

<a href="#check_permissions_avoid_play_store_app_filtering">__check permissions in order to avoid play store app filtering__</a>

<a></a>

in order to get sha1 to use it in many services, like google+ sign in, maps, in app purchases, we should generate keys for every keystore (certificate):

or

the output would be something similar to:

if you’re using <code>penaltylog()</code>, the default, just run

and watch the terminal output. any violations will be logged to your console, slightly rate-limited for duplicate elimination.

if you want to get fancier, turn on <code>penaltydropbox()</code> and they’ll be written to the dropboxmanager, where you can extract them later with

if multiple devices are attached, use <code>adb -s device_id</code> to target a specific device

to uninstall the application using uninstall dialog:

this command sends the power button event to turn the device on/off.

this command sends the event that unlocks the lockscreen on the device. it can be combined with the power button command above to turn on and unlock the device

it can be combined with tagname command, to filter by tagname and priority

that's it. whenever any of the installed apps now accesses the database you should see the executed statement in the log output.

the monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. you can use the monkey to stress-test applications that you are developing, in a random yet repeatable manner.

<a href="http://vitovalov.com/2016/07/18/adb-date-changer.html">source</a>

to check the alarms that are set on the connected device and to know more about them:

to see the alarms from you app you can grep with your package keywords:

so now you can see if you have correctly implemented your alarms functionality using alarmmanager api.

<a href="http://vitovalov.com/2016/07/18/adb-date-changer.html">more info here</a>

abi (application binary interface) is gonna tell us if an android device support 64-bit. so using the next command the developer know if the device is 32-bit or 64-bit based.

you'll need : adb activated physical access to unlocked device works on nexus 5 at least, might not work with other devices. allowbackup=false will break thos method

purpose of dumpsys is identifying frame rate issues and fix them.

what matter is the three columns shown. copy paste results in a spreadsheet. and you will get a result like this one:

AndroidShell (Mac Os Commands)AndroidShell (Mac Os Commands)

this is the data you can grab. you can create a stack graph, so every bar contains the sum of the three columns on the left in the data we output. is the time it takes to update the display list on every frame.

the middle column is called process display list. it's the time we take to draw the actual display list

the last column is the time we take to swap the buffers, so to give the buffer back to surface flinger. scrolling or doing any kind of actions should be below 16 millisecond limit. so this app is running at 60fps, we're vsync'd, everything is going great. you can see that most of the time, you should spend most of the time in process display list, so drawing, executing the display list should be where you spend the bulk of the time.

the blue part is your code. when you write your java code, your <code>ondraw()</code> method, and this is where you can do most of the optimizations

there is a distinction between the gpu composition with frame buffers and overlays. so you can use a tool called dumpsys surface flinger to see the state of overlays and frame buffers in the system.

you're going to get a list with all the windows currently visible on the screen.

prerequisites

android device and computer should be connected in same network.

connect android device with usb cable to computer

use following command in terminal to make sure adb is running in usb mode.

execute following command in terminal to make sure adb identify/list gets connected with the device.

change adb mode from usb to tcpip using following command.

now, adb is running over tcp/ip mode, let’s find ip address of android device. go to settings in android device -&gt; about -&gt; status -&gt; ip address. note down the ip address of connected android device.

use following command to connect adb with ip address

now adb is working over wi-fi, you can remove usb cable from android device.

to confirm adb is working over wi-fi and your device is still connect. you can use following command

you’re now ready to go!, enjoy adb over wi-fi.

use following command to change adb mode to usb

in order to test permissions targeting api 23+, we could use following commands to programatically grant and revoke permissions on the device:

<a href="http://developer.android.com/intl/ru/training/monitoring-device-state/doze-standby.html?utm_campaign=android_series_appstandby_012116&amp;utm_source=medium&amp;utm_medium=blog#testing_your_app_with_app_standby">source</a>

to test the app standby mode with your app:

configure a hardware device or virtual device with an android 6.0 (api level 23) or higher system image.

connect the device to your development machine and install your app.

run your app and leave it active.

force the app into app standby mode by running the following commands:

simulate waking your app using the following commands:

observe the behavior of your app after waking it. make sure the app recovers gracefully from standby mode. in particular, you should check if your app's notifications and background jobs continue to function as expected.

you can test doze mode by following these steps:

shut off the device screen. (the app remains active.)

force the system to cycle through doze modes by running the following commands:

you may need to run the second command more than once. repeat it until the device state changes to idle.

observe the behavior of your app after you reactivate the device. make sure the app recovers gracefully when the device exits doze.

<a href="http://michaelevans.org/blog/2016/08/23/enabling-night-mode-on-android-nougat/">source</a>

<a href="https://goo.gl/jpxelo">source</a>

certain permissions also imply certain features. google play uses these to filter out apps just as it would with explicit requirements. developers should not rely on this implicit behavior, they should always declare explicitly every feature their app needs.

aapt allows us, among other things, to see the contents of an app’s manifest. this is not as easy as simply unpacking the apk and reading the manifest as you’ll find it’s in a binary format. here is the result of running the sdk-provided aapt tool in its apk:

output

继续阅读