Android 8.1 MTK6739平台客制化修改文档

1. 信息-设置-通知-重要程度-中(不发出提示音),非锁屏界面下无提示通知框弹出

vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java

method:shouldPeek

@@ -7578,8 +7578,8 @@ private PowerManager.WakeLock mNotificationWakeLock;
         }
 
         // Allow peeking for DEFAULT notifications only if we're on Ambient Display.
-         int importanceLevel = isDozing() ? NotificationManager.IMPORTANCE_DEFAULT
-                : NotificationManager.IMPORTANCE_HIGH

+        // int importanceLevel = isDozing() ? NotificationManager.IMPORTANCE_DEFAULT
+        //        : NotificationManager.IMPORTANCE_HIGH;
+        int importanceLevel = NotificationManager.IMPORTANCE_LOW
         if (mNotificationData.getImportance(sbn.getKey()) < importanceLevel) {
             if (true/**DEBUG*/) Log.d(TAG, "No peeking: unimportant notification: " + sbn.getKey());
             return false;

 

2. 关机动画播放时长/关机时长/关机动画播放不全

vendor/mediatek/proprietary/frameworks/base/services/core/java/com/mediatek/server/MtkShutdownThread.java

method:showCustomizedShutdownAnimation

-    private static final int MIN_SHUTDOWN_ANIMATION_PLAY_TIME = 5 * 1000;
+    private static final int MIN_SHUTDOWN_ANIMATION_PLAY_TIME = 10 * 1000;//



         beginAnimationTime = 0;
         boolean mShutOffAnimation = configShutdownAnimation(context);
-        int screenTurnOffTime = getScreenTurnOffTime(context);
+        int screenTurnOffTime = MIN_SHUTDOWN_ANIMATION_PLAY_TIME;//getScreenTurnOffTime(context);
         synchronized (mEnableAnimatingSync) {
             if (mEnableAnimating) {
                 if (mShutOffAnimation) {

 

3. 灭屏状态下收到短信、蓝牙收到文件,屏幕亮屏

vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java

+private PowerManager.WakeLock mNotificationWakeLock;


     public void onAsyncInflationFinished(Entry entry) {
         mPendingNotifications.remove(entry.key);
         // If there was an async task started after the removal, we don't want to add it back to
         // the list, otherwise we might get leaks.
         boolean isNew = mNotificationData.get(entry.key) == null;
+               mNotificationWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
+                   | PowerManager.ON_AFTER_RELEASE, TAG);
+               //end
+               mNotificationWakeLock.setReferenceCounted(false);
         if (isNew && !entry.row.isRemoved()) {


    protected void addNotificationViews(Entry entry) {
        if (entry == null) {
            return;
        }
        // Add the expanded view and icon.
        mNotificationData.add(entry);
        Log.d(TAG, "packgename:"+entry.key);
+       //add 
+        if (!mPowerManager.isScreenOn() && entry.key != null && (entry.key.contains("com.google.android.apps.messaging")
+             || entry.key.contains("com.android.bluetooth"))){
+            mNotificationWakeLock.acquire(5000);
+            Log.d(TAG, "special app notification turn screen on");
+        }
+        //end
        updateNotifications();
    }


    public void updateNotification(StatusBarNotification notification, RankingMap ranking)
            throws InflationException {
......
        if (entry == null) {
            return;
        }
        
        mNotificationData.add(entry);
+        //add
+        if (!mPowerManager.isScreenOn() && entry.key != null && (entry.key.contains("com.google.android.apps.messaging") 
+                    || entry.key.contains("com.android.bluetooth"))){
+            mNotificationWakeLock.acquire(5000);
+            Log.d(TAG, "special app notification turn screen on");
+        }
+        //end
        mHeadsUpEntriesToRemoveOnSwitch.remove(entry);
        mRemoteInputEntriesToRemoveOnCollapse.remove(entry);
......

4. 默认音量

frameworks/base/media/java/android/media/AudioSystem.java

@@ -866,11 +866,11 @@ public class AudioSystem
     */
     public static int[] DEFAULT_STREAM_VOLUME = new int[] {
         4,   // STREAM_VOICE_CALL
-        15,  // STREAM_SYSTEM
-        15,   // STREAM_RING
-        15,   // STREAM_MUSIC
-        15,   // STREAM_ALARM
-        15,   // STREAM_NOTIFICATION
+        12,  // STREAM_SYSTEM
+        12,   // STREAM_RING
+        12,   // STREAM_MUSIC
+        12,   // STREAM_ALARM
+        12,   // STREAM_NOTIFICATION

多媒体音量

frameworks/base/services/core/java/com/android/server/audio/AudioService.java

@@ -712,7 +712,7 @@ public class AudioService extends IAudioService.Stub
                         MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 4;
             } else {
                 AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] =
-                        MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3;
+                        /*MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3*/ 12;
             }
         }

5. 默认亮度

vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml

+    158

6. 去掉设置-应用和通知-查看全部23个应用-信息-应用通知-应用中的其他设置

vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/notification/NotificationSettingsBase.java

     protected void addAppLinkPref() {
-        if (mAppRow.settingsIntent != null && mAppLink == null) {

+        if (mAppRow.settingsIntent != null && mAppLink == null &&
+            !mAppRow.pkg.equals("com.google.android.apps.messaging")) {
             addPreferencesFromResource(R.xml.inapp_notification_settings);
             mAppLink = (Preference) findPreference(KEY_APP_LINK);

7. 打开设置-存储中的默认存储器菜单及功能

vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/mediatek/settings/deviceinfo/StorageSettingsExts.java

@@ -57,13 +57,14 @@ public class StorageSettingsExts {
         mDiskCategory = (PreferenceCategory) mRoot
                 .findPreference(KEY_DEFAULT_WRITE_DISK);
 
-        if (!FeatureOption.MTK_DEFAULT_WRITE_DISK || FeatureOption.MTK_A1_FEATURE) {
+        if (FeatureOption.MTK_DEFAULT_WRITE_DISK || FeatureOption.MTK_A1_FEATURE) {
             mRoot.removePreference(mDiskCategory);
         }
     }
 
     private void updateDefaultWriteDiskCategory() {
-        if (!FeatureOption.MTK_DEFAULT_WRITE_DISK || FeatureOption.MTK_A1_FEATURE) {
+        if (FeatureOption.MTK_DEFAULT_WRITE_DISK || FeatureOption.MTK_A1_FEATURE) {
             return;
         }

vendor/mediatek/proprietary/frameworks/base/core/java/com/mediatek/storage/StorageManagerEx.java

@@ -101,8 +101,15 @@ public class StorageManagerEx {
         boolean supportMultiUsers = false;
 
         // Modifications for O1.BSP+ as default path feature is not supported.
-        path = Environment.getExternalStorageDirectory().getAbsolutePath();
+       // path = Environment.getExternalStorageDirectory().getAbsolutePath();
+          path = SystemProperties.get(PROP_SD_DEFAULT_PATH);
+          Log.i(TAG,"path1:"+path);
+          if(path.equals("")){
+                  path = Environment.getExternalStorageDirectory().getAbsolutePath();
+          }
         Log.i(TAG, " Default path taken as primary storage, path=" + path);
         // Modifications complete for O1.BSP+.
         return path;

通话录音、FM录音默认存储跟随设置

vendor/mediatek/proprietary/packages/apps/FMRadio/src/com/android/fmradio/FmUtils.java

+import com.mediatek.storage.StorageManagerEx;


@@ -201,7 +202,8 @@ public class FmUtils {
      * @return The phone storage path
      */
     public static String getDefaultStoragePath() {
-        return Environment.getExternalStorageDirectory().getPath();
+       // return Environment.getExternalStorageDirectory().getPath();
+          return StorageManagerEx.getDefaultPath();
     }

vendor/mediatek/proprietary/packages/services/CallRecorderService/src/com/mediatek/callrecorder/Recorder.java

@@ -116,8 +116,8 @@ public abstract class Recorder implements OnErrorListener {
 
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
         String prefix = dateFormat.format(new Date());
-        //File sampleDir = new File(StorageManagerEx.getDefaultPath());
-        File sampleDir = Environment.getExternalStorageDirectory();
+        File sampleDir = new File(StorageManagerEx.getDefaultPath());
+        //File sampleDir = Environment.getExternalStorageDirectory();

8. 相机设置拍照预览默认4:3

vendor/mediatek/proprietary/packages/apps/Camera/src/com/android/camera/bridge/CameraDeviceExt.java

@@ -190,7 +190,8 @@ public class CameraDeviceExt implements ICameraDeviceExt {
                     mParametersExt);
             if (supportedRatios != null && supportedRatios.size() > 0) {
                 SharedPreferences.Editor editor = mPreferences.edit();
-                String ratioString = supportedRatios.get(supportedRatios.size() - 1);
+                //String ratioString = supportedRatios.get(supportedRatios.size() - 1);
+                               String ratioString = supportedRatios.get(0);
       editor.putString(SettingConstants.KEY_PICTURE_RATIO, ratioString);
                 editor.apply();
                 pictureRatio = ratioString;

vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/setting/SettingUtils.java

@@ -259,7 +259,8 @@ public class SettingUtils {
         String ratioString = null;
         if (supportedRatios != null && supportedRatios.size() > 0) {
             SharedPreferences.Editor editor = sharedPreferences.edit();
-            ratioString = supportedRatios.get(supportedRatios.size() - 1);
+            //ratioString = supportedRatios.get(supportedRatios.size() - 1);
+                       ratioString = supportedRatios.get(0);
             editor.putString(SettingConstants.KEY_PICTURE_RATIO, ratioString);
             editor.apply();

9. 文件默认显示内部存储设备

     public static boolean mustShowDeviceRoot(Intent intent) {
         /// M: Discussed with QA, this option should always be shown
-        return false;
+        return true;
         //return intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
     }

 10. Camera 屏蔽高温报警和连拍

vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/AdditionManager.java

@@ -78,12 +78,12 @@ public class AdditionManager {
         mIContinuousShotAddition = new ContinuousShot(cameraContext);
         mDistanceInfo = new DistanceInfo(cameraContext);
         mRemoteCameraAddition = new RemoteCameraAddition(cameraContext);
-        mNormalAddition.add(new ThermalThrottle(cameraContext));
+       // mNormalAddition.add(new ThermalThrottle(cameraContext));
         mPhotoAddtion.add(new Asd(cameraContext));
-        mPhotoAddtion.add(mIContinuousShotAddition);
+        //mPhotoAddtion.add(mIContinuousShotAddition);
         mNormalAddition.add(mDistanceInfo);
         mPhotoAddtion.add(mRemoteCameraAddition);
-        mDenoiseAddition.add(mIContinuousShotAddition);
+       // mDenoiseAddition.add(mIContinuousShotAddition);
     }

vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/addition/thermalthrottle/ThermalThrottle.java

@@ -148,7 +148,7 @@ public class ThermalThrottle extends CameraAddition {
     private void updateCountDownTime(final Activity activity) {
         Log.d(TAG, "[updateCountDownTime]mCountDown = " + mWatingTime + ",mIsResumed = "
                 + mIsResumed);
-        if (isTemperTooHigh()) {
+        if (false/**isTemperTooHigh()**/) {
             if (mWatingTime > 0) {
                 mWatingTime--;
                 mAlertDialog.setCountDownTime(String.valueOf(mWatingTime));

11. 低电量不能开启手电筒

vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java

+import android.os.BatteryManager;
+import android.widget.Toast;



     public void setFlashlight(boolean enabled) {

+        BatteryManager batteryManager=(BatteryManager)mContext.getSystemService(mContext.BATTERY_SERVICE);
+        int counter = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER);
+        int averge = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE);
+        int current_now = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW);
+        Log.d(TAG,"FlashlightControllerImpl::setFlashlight...counter:"+counter+", averge:"+averge+", current_now:"+current_now); 
+
+        boolean enoughtBatteryLevel = counter >= 3;
+        if(!enoughtBatteryLevel){
+              Toast.makeText(mContext, "low battery level", 3000).show();
+        }
+        
+        enabled = enabled&enoughtBatteryLevel;

         boolean pendingError = false;
         synchronized (this) {
             if (mCameraId == null) return;

12. 添加虚拟键振动功能

frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

@@ -6097,7 +6097,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         }
 
         boolean useHapticFeedback = down
-                && (policyFlags & WindowManagerPolicy.FLAG_VIRTUAL) != 0
+               // && (policyFlags & WindowManagerPolicy.FLAG_VIRTUAL) != 0
                 && event.getRepeatCount() == 0;

13. 去掉关闭网络数据时的叉号

vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java

-    static final int ICON_DATA_DISABLED = R.drawable.stat_sys_data_disabled;
+    static final int ICON_DATA_DISABLED = -1/**R.drawable.stat_sys_data_disabled**/;
 
-    static final int QS_ICON_DATA_DISABLED = R.drawable.ic_qs_data_disabled;
+    static final int QS_ICON_DATA_DISABLED = -1/**R.drawable.ic_qs_data_disabled**/;

14. 切换语言后设置中的"勿扰偏好设置"菜单下的自动规则字符串不刷新

frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java

@@ -818,8 +818,9 @@ public class NotificationManagerService extends SystemService {
         @Override
         public void onReceive(Context context, Intent intent) {
             if (Intent.ACTION_LOCALE_CHANGED.equals(intent.getAction())) {
-                mZenModeHelper.updateDefaultZenRules();
+                //mZenModeHelper.updateDefaultZenRules();      devin.2018419
                 mRankingHelper.onLocaleChanged(context, ActivityManager.getCurrentUser());
+                               mZenModeHelper = new ZenModeHelper(getContext(), mHandler.getLooper(), mConditionProviders);
             }
         }
     };

 15. 客制化BT,WiFi direct,WLAN热点名称

BT:device/generic/common/bluetooth/bdroid_buildcfg.h

-#define BTM_DEF_LOCAL_NAME   "Android Bluedroid"
+#define BTM_DEF_LOCAL_NAME   "xxxxx"

WiFi direct:vendor/mediatek/proprietary/packages/apps/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

@@ -2659,6 +2659,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
             loadSetting(stmt, Settings.Global.ENHANCED_4G_MODE_ENABLED,
                     ImsConfig.FeatureValueConstants.ON);
 
+            loadSetting(stmt, Settings.Global.WIFI_P2P_DEVICE_NAME,"XXXXX");
+
             /// M: Load MTK added Global providers before Android M.
             mUtils.loadCustomGlobalSettings(stmt);

WLAN热点:frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiApConfigStore.java

@@ -207,8 +207,9 @@ public class WifiApConfigStore {
      */
     private WifiConfiguration getDefaultApConfiguration() {
         WifiConfiguration config = new WifiConfiguration();
-        config.SSID = mContext.getResources().getString(
-                R.string.wifi_tether_configure_ssid_default) + "_" + getRandomIntForDefaultSsid();
+        //config.SSID = mContext.getResources().getString(
+         //       R.string.wifi_tether_configure_ssid_default) + "_" + getRandomIntForDefaultSsid();
+        config.SSID = "xxxxx";
         config.allowedKeyManagement.set(KeyMgmt.WPA2_PSK);
         String randomUUID = UUID.randomUUID().toString();

16. 12小时制,锁屏/状态栏增加A/PM显示

锁屏:vendor/mediatek/proprietary/packages/apps/SystemUI/res-keyguard/values/strings.xml

-    h:mm
+    aa

vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/keyguard/KeyguardStatusView.java

@@ -308,9 +308,9 @@ public class KeyguardStatusView extends GridLayout {
             clockView12 = DateFormat.getBestDateTimePattern(locale, clockView12Skel);
             // CLDR insists on adding an AM/PM indicator even though it wasn't in the skeleton
             // format.  The following code removes the AM/PM indicator if we didn't want it.
-            if (!clockView12Skel.contains("a")) {
+            /* meng if (!clockView12Skel.contains("a")) {
                 clockView12 = clockView12.replaceAll("a", "").trim();
-            }
+            }*/
 
             clockView24 = DateFormat.getBestDateTimePattern(locale, clockView24Skel);

状态栏:vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java

@@ -108,8 +108,9 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C
         try {
             mSystemUIFactoryBase = OpSystemUICustomizationFactoryBase.getOpFactory(context);
             mStatusBarExt = mSystemUIFactoryBase.makeSystemUIStatusBar(context);
-            mAmPmStyle = mStatusBarExt.getClockAmPmStyle(a.getInt(R.styleable.Clock_amPmStyle,
-                    AM_PM_STYLE_GONE));
+            //mAmPmStyle = mStatusBarExt.getClockAmPmStyle(a.getInt(R.styleable.Clock_amPmStyle,
+            //        AM_PM_STYLE_GONE));
+                       mAmPmStyle = AM_PM_STYLE_NORMAL;
             mShowDark = a.getBoolean(R.styleable.Clock_showDark, true);
         } finally {
             a.recycle();

 17. 长按Home键 取消屏幕固定

frameworks/base/core/res/res/values/strings.xml

-    To unpin this screen, touch & hold Back and Overview
-        buttons
+    To unpin this screen, touch & hold Home buttons

vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/strings.xml

-    This keeps it in view until you unpin. Touch & hold Back and Overview to unpin.
+    This keeps it in view until you unpin. Touch & hold Home to unpin.

frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

+import android.app.IActivityManager;
+import android.view.accessibility.AccessibilityManager;
+import android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener;
+import android.app.ActivityManagerNative;


+    private void onLongPressBackMenu(){
+            IActivityManager activityManager = ActivityManagerNative.getDefault();
+            boolean touchExplorationEnabled = mAccessibilityManager.isTouchExplorationEnabled();
+            try {
+                boolean inLockTaskMode = activityManager.isInLockTaskMode();
+                Log.d("joyatel","onLongPressBackMenu......inLockTaskMode:"+inLockTaskMode+", touchExplorationEnabled:"+touchExplorationEnabled);
+                if (inLockTaskMode && !touchExplorationEnabled) {
+                     activityManager.stopLockTaskMode();
+                }
+
+
+            } catch (RemoteException e) {
+                Log.d(TAG, "Unable to reach activity manager", e);
+            }    
+
+                   
+    }


@@ -3488,6 +3511,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             } else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
                 if (!keyguardOn) {
                     handleLongPressOnHome(event.getDeviceId());
+                    onLongPressBackMenu();
                 }
             }

18. 联系人-任意联系人-设置-设置铃声-默认铃声的状态下点击添加铃声,返回后没有焦点

packages/providers/MediaProvider/src/com/android/providers/media/RingtonePickerActivity.java @{
+    protected void onResume() {
+               super.onResume();
+               requeryForAdapter();
+       }
+       ///@}


     private void requeryForAdapter() {
         // Refresh and set a new cursor, closing the old one.
         initRingtoneManager();
         mAdapter.changeCursor(mCursor);
  
         // Update checked item location.
-        int checkedPosition = POS_UNKNOWN;
+        int checkedPosition = /*POS_UNKNOWN*/getCheckedItem();//devin.20180518
         for (int i = 0; i < mAdapter.getCount(); i++) {
             if (mAdapter.getItemId(i) == mCheckedItemId) {
                 checkedPosition = getListPosition(i);

19.主界面hotseat打开相机,底部有白线packages/apps/Launcher3/src/com/android/launcher3/Launcher.java

@@ -2672,6 +2672,7 @@ public class Launcher extends BaseActivity
         // private contract between launcher and may be ignored in the future).
         boolean useLaunchAnimation = (v != null) &&
                 !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
+           useLaunchAnimation = false; //andy
         Bundle optsBundle = useLaunchAnimation ? getActivityLaunchOptions(v) : null;
  
         UserHandle user = item == null ? null : item.user;

 20. 默认SIM卡短信设置去掉每次都询问

  vendor/mediatek/proprietary/packages/apps/MtkSettings/ext/src/com/mediatek/settings/ext/DefaultRCSSettings.java

   public boolean isNeedAskFirstItemForSms() {
         Log.d("@M_" + TAG, "isNeedAskFirstItemForSms");
-        return true;
+        return false;///mh.20180523 default=true
     }

  vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/sim/SimDialogActivity.java

private int getPickSmsDefaultSub(final List subInfoList,
            int value) {
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        if (value < 1) {
            int length = subInfoList == null ? 0 : subInfoList.size();
+            //if (length == 1) {
                 subId = subInfoList.get(value).getSubscriptionId();
+            //} else {
+            //    subId = MtkDefaultSmsSimSettings.ASK_USER_SUB_ID;
+            //}
        } else if (value >= 1 && value < subInfoList.size() + 1) {
            subId = subInfoList.get(value).getSubscriptionId();
        }
        subId = mRCSExt.getDefaultSmsClickContentExt(subInfoList, value, subId);
        Log.d(TAG, "getPickSmsDefaultSub, value: " + value + ", subId: " + subId);
        return subId;
    }

 

你可能感兴趣的:(MTK随记)