Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the necessary knowledge points for Android development?

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what are the necessary knowledge points for Android development". In the daily operation, I believe that many people have doubts about the necessary knowledge points for Android development. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what are the necessary knowledge points for Android development?" Next, please follow the editor to study!

First, check the CPU temperature

1. Use ADB to view CPU temperature (debug version)

The view CPU command is as follows:

Adb shell cat / sys/class/thermal/thermal_zone*/temp

two。 Check the classification information corresponding to the content returned by CPU.

Adb shell cat / sys/class/thermal/thermal_zone*/type

CPU temperature View Command method

The CPU temperature viewed from this includes three decimal places, leaving out the decimal point. This method is suitable for MTK platform.

View CPU temperature in 3.MTK log

Search for the keyword T_AP in kernel log to view the CPU temperature.

Second, boot wizard debugging related methods 1.debug version skips boot wizard scheme

1. Click on the shortcut operation four times

Continuously click on the four corners of the screen (upper left-upper right-> lower right-> lower left) to skip the boot wizard.

2.adb Command disable boot wizard

Adb shell settings put secure user_setup_complete 1adb shell settings put global device_provisioned 1adb shell pm disable com.google.android.setupwizard/.SetupWizardActivity2.debug restart boot wizard scheme

To skip the boot wizard and then go back to the boot wizard, you can try the following command.

1. Reset the value set after the boot wizard is completed

The command is as follows:

Adb shell settings put secure user_setup_complete 0adb shell settings put global device_provisioned 0

two。 The setup boot wizard is available and starts

After the boot wizard, the boot wizard apk is set to be unavailable.

At this point we should set the boot wizard to enble status.

Adb shell pm enable com.google.android.setupwizard/.SetupWizardActivityadb shell am start-n com.google.android.setupwizard/.SetupWizardActivity3. Boot wizard log debugging

Open the boot wizard to debug Log as follows:

Adb shell setprop log.tag.SetupWizard VERBOSE4. The method of skipping the boot wizard in the code

The ways to skip the boot wizard in the code are as follows:

Private void SkipSetupwizard () {ActivityManager activityAanager = (ActivityManager) mContext .getSystemService (Context.ACTIVITY_SERVICE); ComponentName cn = activityAanager.getRunningTasks (1) .get (0) .topActivity; String pName = cn.getPackageName () If ("com.google.android.setupwizard" .equals (pName)) {Settings.Global.putInt (mContext.getContentResolver (), Settings.Global.DEVICE_PROVISIONED, 1); Settings.Secure.putInt (mContext.getContentResolver (), Settings.Secure.USER_SETUP_COMPLETE, 1); activityAanager.forceStopPackage ("com.google.android.setupwizard") Log.i ("wjwj", "- skip com.google.android.setupwizard-");}} third, check the APP startup time 1. Use the adb command to grab log for viewing

Adb logcat | findstr Displayed

Or grab adb Log directly, and then search for the keyword Displayed

APP cold start time statistics

Search keyword Display in adb Log

two。 Check the method of cold start of app multiple times

The method to test 10 cold starts of Chrome is as follows:

Adb shell am start-S-R10-W com.android.chrome/com.google.android.apps.chrome.Main

The test results are as follows:

C:\ Users\ Administrator > adb shell am start-S-R10-W com.android.chrome/com.google.android.apps.chrome.MainStopping: com.android.chromeStarting: Intent {act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] cmp=com.android.chrome/com.google.android.apps.chrome.Main} Status: okActivity: com.android.chrome/org.chromium.chrome.browser.firstrun.FirstRunActivityTotalTime: 1514WaitTime: 1525CompleteStopping: com.android.chromeStarting: Intent {act=android.intent.action.MAIN cat= [android .intent.roomy.LAUNCHER] flg=0x10000000 cmp=com.android.chrome/com.google.android.apps.chrome.Main} Status: okActivity: com.android.chrome/org.chromium.chrome.browser.firstrun.FirstRunActivityTotalTime: 534WaitTime: 549Complete IV. Judge user Userdebug version of the method private static final boolean USER_BUILD = android.os.Build.IS_USER

Looking at the Build.java, it is found that these are hidden methods from the external apk and can only be used by applications signed by the system platform.

/ * {@ hide} * / public static final boolean IS_ENG = "eng" .equals (TYPE); / * {@ hide} * / public static final boolean IS_USERDEBUG = "userdebug" .equals (TYPE); / * {@ hide} * / public static final boolean IS_USER = "user" .equals (TYPE); 5. Modify the default storage path for screenshots.

/ frameworks/base/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java

/ / import com.mediatek.storage.StorageManagerEx; String defaultWritePath = StorageManagerEx.getDefaultPath () + File.separator+ "Pictures"; mScreenshotDir = new File (defaultWritePath, SCREENSHOTS_DIR_NAME); VI. Analytic kernel dump method 1. Append all systemdump files to one file

First we need to catch the dumpsys log, and then append all the systemcore* files to one file.

Cat systemcore* > all

Append all sysdump files to one file

two。 Parsing dump files using the corresponding version of vmlinux

Use the crash_arm command to parse the dump file

32-bit systems are used as follows:

. / crash_arm vmlinux all-m phys_base=0x80000000

64-bit systems use the following commands:

. / crash_arm64 vmlinux all-m phys_offset=0x80000000

3. Debug after successful parsing

Parse the log method after successfully parsing dump

Log > log.txt

Use the log command to read log to the specified file

7. SPRD turns on Ylog and dumpsys enable method by default

Modify device\ sprd\ xxxx\ common\ rootdir\ root\ init.common.rc

Add the following to on post-fs-data:

On post-fs-data. This sentence is used to open the ylog setprop debug.sysdump.enabled true / / add this sentence to open the sysdump setprop persist.sys.eng.reset 1 ylog setprop debug.sysdump.enabled true / add this sentence to open the sysdump setprop persist.sys.eng.reset 1 start ylog 8, the method to determine whether the monkey is being tested public boolean isMonkeyRunning () {return ActivityManager.isUserAMonkey ();} IX. The method to modify the MTK log mode

Modify the property values configured under the following path to either alps\ device\ mediatek\ common\ mtklog

Change false to true to open the corresponding log.

Mtklog_path = internal_sdcom.mediatek.log.mobile.enabled = falsecom.mediatek.log.mobile.maxsize = 500com.mediatek.log.mobile.totalmaxsize = 1000com.mediatek.log.modem.enabled = falsecom.mediatek.log.modem.maxsize = 2000com.mediatek.log.net.enabled = falsecom.mediatek.log.net.maxsize = 600com.mediatek.log.gps.enabled = false +, Mobile log only on MTK platform

Enter the password * 3646633 please enter the MTK Logger interface, open Logger Setting in the upper right corner, and manually turn off the switch except Moblie Log.

For the shutdown method, please see the following figure:

Mtk platform Open Mobile log reference Picture

11. Only Android log method is available on SPRD platform.

Enter the code * # 83781 "password" to enter the SPRD Logger interface, open Settings in the upper right corner, click Custom scene, and turn off the switch except Android log. For the closing method, please see the figure below.

SPRD platform Open Android log reference Picture

12. SPRD platform power consumption Log considerations

Only Android Log (refer to 11, SPRD platform only Android log method)

Enter the DEBUG&Log interface, system info- > Power Log

Open PowerGuru log and wakelock log

Restart the device.

Reset the battery history using the following command

Adb shell dumpsys batterystats-enable full-wake-historyadb shell dumpsys batterystats-reset

When the test is complete, use the following command to grab the bugreport

Adb rootadb bugreport > bugreport.zip

Finally, both andorid log and bugreport.zip are provided.

13. Get the Top Activity package name

The method to obtain Activity Top is as follows:

/ / import android.app.ActivityManager;//import android.app.ActivityManager.RunningTaskInfo;//import android.content.ComponentName;//import java.util.List;// get topActivity apk public String getTopActivityPackageName (Context context) {String topActivityPackage = null; ActivityManager activityManager = (ActivityManager) (context .getSystemService (android.content.Context.ACTIVITY_SERVICE)) List runningTaskInfos = activityManager .getRunningTasks (1); if (runningTaskInfos! = null) {ComponentName f = runningTaskInfos.get (0) .topActivity; topActivityPackage = f.getPackageName (); / / Slog.e ("wangjie", "- topActivityPackage-" + topActivityPackage) } return topActivityPackage;} 14. Modify the welcome words of the Google boot wizard

The welcome words of the boot wizard in Bengali are wrong, and the customer asked to remove the welcome words in the boot wizard interface.

Idh.code/frameworks/base/core/java/android/widget/TextView.java

Public class TextView extends View implements ViewTreeObserver.OnPreDrawListener {...... Public void setTextLocale (@ NonNull Locale locale) {+ / / add for Bangla language+ if (getContext (). GetClass (). GetName (). Equals ("com.google.android.setupwizard.user.WelcomeActivity") & & + locale.getLanguage (). Equals ("bn") & & locale.getCountry (). Equals ("BD") + {+ Log.i (LOG_TAG, "find text:" + getText ()) + if (! getText () .equals (") & &! getText () .toString () .contains (" ()) + Log.i (LOG_TAG, "set text:" + getText ()); + setText ("); +} + / / add for Bangla language mLocalesChanged = true; mTextPaint.setTextLocale (locale) ..}.} 15. Modify the status bar time display seconds

The method of modifying the status bar time display seconds of Spreadtrum platform is as follows

Adb shell pm enable com.android.systemui/com.android.systemui.tuner.TunerActivityadb shell am start-n com.android.systemui/com.android.systemui.tuner.TunerActivity

Enter Settings-system-Interface Tuner-status Bar-time-display time.

16. The method of judging multi-users

The method of judging multi-user is as follows:

/ / import android.os.UserHandle;if (UserHandle.myUserId ()! = UserHandle.USER_OWNER) {/ / for administrator users to operate} 17. Blur removal under low RAM (1G)

In Android GO, part of the UI experience is sacrificed in order to be compatible with system performance. For example, the recent task list is blurry, the Settings interface is loaded from fuzzy to clear, and the Launcher icon is loaded from fuzzy to clear. However, this has a great impact on the user experience, and I don't think it is very good. The solution to remove the fuzzy effect is as follows:

1. The files that need to be modified are as follows: frameworks/base/services/core/java/com/android/server/wm/AppWindowContainerController.java frameworks/base/services/core/java/com/android/server/wm/TaskSnapshotController.java frameworks/base/services/core/java/com/android/server/wm/TaskSnapshotPersister.java

1.AppWindowContainerController modification method

In the AppWindowContainerController.java class, comment out the scheduleAddStartingWindow method implementation.

Public class AppWindowContainerController extends WindowContainerController {... / / comment out the method void scheduleAddStartingWindow () {/ / Note: we really want to do sendMessageAtFrontOfQueue () because we / / want to process the message ASAP, before any other queued / / messages. / * if (! mService.mAnimationHandler.hasCallbacks (mAddStartingWindow)) {mContainer.startingAdding = true; if (DEBUG_STARTING_WINDOW) Slog.v (TAG_WM, "Enqueueing ADD_STARTING"); mService.mAnimationHandler.postAtFrontOfQueue (mAddStartingWindow);} * * /}.}

2.TaskSnapshotController modification method

Manually set the system to a non-low memory device, such as isLowRamDevice = false.

Class TaskSnapshotController {. / / manually set the system to a non-low memory device final boolean isLowRamDevice = false; / / final boolean isLowRamDevice = ActivityManager.isLowRamDeviceStatic ();.

3.TaskSnapshotPersister modification method

In the TaskSnapshotPersister class, set the DISABLE_FULL_SIZED_BITMAPS state to false.

Class TaskSnapshotPersister {... / / sets the DISABLE_FULL_SIZED_BITMAPS status to false. Static final boolean DISABLE_FULL_SIZED_BITMAPS = false;//static final boolean DISABLE_FULL_SIZED_BITMAPS = ActivityManager.isLowRamDeviceStatic ();...} XVIII, fillet scheme around the screen

The fillet scheme around the SPRD screen needs to be modified. Dtsi file.

Take sc7731e.dtsi as an example. The file path to be modified is kernel4.4/arch/arm/boot/dts/sc7731e.dtsi, where 15 represents the Radian of the fillet. The default right angle is 90 degrees.

The modification method is as follows:

Soc: soc {ap-ahb {dispc0: dispc@20800000 {...... Sprd,ip = "dpu-lite-r1p0"; sprd,soc = "pike2"; / / 15 indicates the Radian of the fillet sprd,corner-radius =; / * output port * / port {dispc0_out: endpoint@0 {remote-endpoint = };.} at this point, the study of "what are the necessary knowledge points for Android development" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report