[SPRD] Indexed

1. A general solution for memory optimization by tailoring applications

[ANSWER]
Stand still for 10 minutes after booting, use the command line command:
adb shell dumpsys meminfo > meminfo.txt
to capture the current memory information, check the Total PSS by OOM adjustment column, and trim unnecessary applications

2. Why some versions do not display emergency call records

[ANSWER]
Whether the current emergency call records are displayed is controlled by the version (operator).
1. All versions need to display emergency phone call records
/packages/services/Telecomm/res/values/config.xml
true
2. One or more operators need to be displayed, while others are not displayed
under /vendor/sprd/carriers Select the operator, for example, if claro needs to be displayed, add
/vendor/sprd/carriers/claro/overlays/packages/services/Telecomm/res/values/
true
/packages/services/Telecomm/res/values/config.xml
false

3. How to shield the status bar and navigation keys in an Activity

[ANSWER]
1. Disable the pull-down status bar on an Activity interface:
// Get StatusBarManager
StatusBarManager mStatusBarManager = (StatusBarManager) mContext.getSystemService(Context.STATUS_BAR_SERVICE);
// Disable the pull-down status bar
mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
/ / Unban
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE) when exiting;
2. Disable a certain navigation key in an Activity interface:
You can block the Back/Home/Recent keys in the navigation bar through the following flags, and the blocking method is the same as above. StatusBarManager.DISABLE_BACK/StatusBarManager.DISABLE_HOME/StatusBarManager.DISABLE_RECENT

4. How to configure the default value of high temperature shutdown?

[ANSWER]
There is a high temperature shutdown on the upper layer of the platform, but no low temperature shutdown, configure it below, the default is 68 degrees shutdown
/frameworks/base/core/res/res/values/config.xml

680

5. On the main interface of the Launcher, after long pressing the shortcut of the specified application, you can drag it, but the remove button above is not displayed

[ANSWER]
Locate to src/com/android/launcher3/ButtonDropTarget.java

public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
    
    
+     if("com.android.xxx".equals(dragObject.dragInfo.getTargetComponent().getPackageName()))  //com.android.xxx为不可移除的应用包名
+        {
    
    
+            setVisibility(View.GONE);
+        }
+        else
+        {
    
    
            mActive = supportsDrop(dragObject.dragInfo);
            mDrawable.setColorFilter(null);
            if (mCurrentColorAnim != null) {
    
    
                mCurrentColorAnim.cancel();
                mCurrentColorAnim = null;
            }
            setTextColor(mOriginalTextColor);
            setVisibility(mActive ? View.VISIBLE : View.GONE);
            mAccessibleDrag = options.isAccessibleDrag;
            setOnClickListener(mAccessibleDrag ? this : null);
+        }
    }

6. How to get imei via adb

[ANSWER]
Android11:
adb shell service call iphonesubinfo 1

Android12:
(a) userdebug needs to execute adb root
adb shell service call iphonesubinfo 4 i32 0 s16 com.android.phone null

(b) User version uses shell
adb shell service call iphonesubinfo 4 i32 2 s16 shell null

Android 13
adb shell service call iphonesubinfo 4 i32 1 s16 shell

7. How to modify the Android 10 platform to support simultaneous recording of multiple applications

[ANSWER]
Add the corresponding audio source in AudioPolicyService::isVirtualSource.
For example: Assuming that the audio source type applied by the application layer is MediaRecorder.AudioSource.MIC, add the corresponding audio source in AudioPolicyService::isVirtualSource:

frameworks\av\services\audiopolicy\service\AudioPolicyService.cpp

bool AudioPolicyService::isVirtualSource(audio_source_t source)
{
    
    
    switch (source) {
    
    
        case AUDIO_SOURCE_VOICE_UPLINK:
        case AUDIO_SOURCE_VOICE_DOWNLINK:
        case AUDIO_SOURCE_VOICE_CALL:
        case AUDIO_SOURCE_REMOTE_SUBMIX:
        case AUDIO_SOURCE_FM_TUNER:
+++	    case AUDIO_SOURCE_MIC:
            return true;
        default:
            break;
    }
    return false;
}

8. How does Spreadtrum achieve automatic power-on after plugging in the USB

[ANSWER]
在u-boot15\common\cmd_cboot.c

boot_mode_enum_type get_mode_from_charger(void

if (charger_connected()) {
    
    

debugf("get mode from charger\n");

return CMD_CHARGE_MODE;  //改为return CMD_NORMAL_MODE;

} else {
    
    

return CMD_UNDEFINED_MODE;

}

9. How does the background recording app record audio during a call

[ANSWER]
1. If the application needs to record calls, it needs to apply for the android.permission.CAPTURE_AUDIO_OUTPUT permission, and the UID is changed to "android.uid.system", that is, it can only be a system application.

2. If the recording application is a third-party application and the application code cannot be modified, it can be modified at the FW layer. The reference code is as follows:

/frameworks/av/services/audiopolicy/service/AudioPolicyService.cpp file

@@ -385,6 +386,13 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr,
     }

     bool canCaptureOutput = captureAudioOutputAllowed(opPackageName,pid, uid);
+
+       if(!strcmp("应用包名",String8(opPackageName).c_str())){
    
    
+               ALOGI("%s, set canCaptureOutput=true, opPackageName=%s",
+                __func__, String8(opPackageName).c_str());
+          canCaptureOutput = true;
+       }
+
     if ((attr->source == AUDIO_SOURCE_VOICE_UPLINK ||
         attr->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
         attr->source == AUDIO_SOURCE_VOICE_CALL ||

10. What is the display logic of the charging information on the lock screen in Android 13?

[ANSWER]
The platform supports displaying different charging prompts for different charging speeds on the lock screen interface, and the charging power corresponding to fast charging and slow charging can be configured in relevant configuration files. The relevant code logic is as follows:

Display corresponding prompts according to the charging speed mChargingSpeed

SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java

     protected String computePowerIndication() {
    
    
...
              switch (mChargingSpeed) {
    
    
                  case BatteryStatus.CHARGING_FAST:
                      chargingId = hasChargingTime
                              ? R.string.keyguard_indication_charging_time_fast
                              : R.string.keyguard_plugged_in_charging_fast;
                      break;
                  case BatteryStatus.CHARGING_SLOWLY:
                      chargingId = hasChargingTime
                              ? R.string.keyguard_indication_charging_time_slowly
                              : R.string.keyguard_plugged_in_charging_slowly;
                      break;
                  default:
                      chargingId = hasChargingTime
                              ? R.string.keyguard_indication_charging_time
                              : R.string.keyguard_plugged_in;
                      break;
              }

Judging charging speed: fast charging, slow charging, regular charging
frameworks/base/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java

      public final int getChargingSpeed(Context context) {
    
    
         final int slowThreshold = context.getResources().getInteger(
                  R.integer.config_chargingSlowlyThreshold);
          final int fastThreshold = context.getResources().getInteger(
                  R.integer.config_chargingFastThreshold);
          return maxChargingWattage <= 0 ? CHARGING_UNKNOWN :
                  maxChargingWattage < slowThreshold ? CHARGING_SLOWLY :
                          maxChargingWattage > fastThreshold ? CHARGING_FAST :
                                  CHARGING_REGULAR;
      }

In the configuration file, less than 5w is slow charging, and more than 15w is fast charging

<!-- These resources are around just to allow their values to be customized -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <!-- Threshold in micro watts below which a charger is rated as "slow"; 1A @ 5V -->
     <integer name="config_chargingSlowlyThreshold">5000000</integer>

    <!-- Threshold in micro watts above which a charger is rated as "fast"; 3A @ 5V  -->
     <!-- UNISOC: modify for Bug1838475 Modify the fast charge threshold -->
    <integer name="config_chargingFastThreshold">15000000</integer>

11. The files under Android 12 pull /data/system/ are garbled characters

[ANSWER]
Android12's /data/system/XXXX.xml is set in binary xml format by default, and it is garbled when opened directly.
You can change it to the normal xml format by modifying the configuration
adb shell setprop persist.sys.binary_xml false
restart the phone, and then get XXXX.xml, which is the normal xml format

Guess you like

Origin blog.csdn.net/u012932409/article/details/128381824