Androidソース人気変更速查(継続更新.....)


1、8.1デフォルト音量調整
frameworksbasemediajavaandroidmediaAudioSystem.java修正DEFAULT_STREAM_VOLUME配列、最大値と最小値の対応ファイルの変更
frameworks\base\services\core\java\com\android\server\audio\AudioService.java
MIN_STREAM_VOLUME MAX_STREAM_VOLUME
メディアボリュームはAudioServiceで初期化されて修正され、強制的に値を割り当てることができます.
AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = defaultMusicVolume;
またはro.config.media_を構成できます.vol_default修正
device\mediateksample\xxxx\system.prop
2、USB接続アイコンの修正
frameworks\base\core\res\res\drawable-nodpi\stat_sys_adb.xml
6.0以前は小さなロボットアイコンを使用していましたが、8.1はオリオアイコン、9.0はPアイコンで、レトロなら6.0からコピーして上書きできます
3、システムタッチプロンプト音のオンとオフ
vendor\mediatek\proprietary\packages\apps\SettingsProvider\res\values\defaults.xml

true

JAvaコードで
 private void handleSoundEffects(boolean isOpen){
        Settings.System.putInt(getContentResolver(),
                Settings.System.SOUND_EFFECTS_ENABLED, isOpen ? 1 : 0);
        final AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        if (isOpen) {
            am.loadSoundEffects();
        } else {
            am.unloadSoundEffects();
        }
    }

タッチプロンプトを置き換えるには、パスframeworksbasedatasoundseffectsEffect_Tick.ogg
4、システムのデフォルトフォントサイズを変更する
システムでサポートされているフォントサイズ範囲の表示vendormediatekproprietarypackagesappsMtkSettingsresvaluesarrays.xml
    <string-array name="entryvalues_font_size" translatable="false">
        <item>0.85</item>
        <item>1.0</item>
        <item>1.15</item>
        <item>1.30</item>
    </string-array>

以下の3箇所の変更は、実際の発効状況によって決定してください.
1、frameworks\base\core\java\android\provider\Settings.java
 public static final class System extends NameValueTable {
	private static final float DEFAULT_FONT_SCALE = 1.0f;

2、frameworks\base\core\java\android\content\res\Configuration.java
    public void setToDefaults() {
        fontScale = 1;
        mcc = mnc = 0;

3、vendor\mediatek\proprietary\packages\apps\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java
private void loadSystemSettings(SQLiteDatabase db) {
		....
loadSetting(stmt, Settings.System.FONT_SCALE, 0.85f);

5、スリープ時間の増加と無停止スクリーンオプション
vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/arrays.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/arrays.xml
@@ -37,6 +37,7 @@
     <item msgid="7489864775127957179">"5  "</item>
     <item msgid="2314124409517439288">"10  "</item>
     <item msgid="6864027152847611413">"30  "</item>
+    <item msgid="7149253832238213885">"    "</item>
   </string-array>
   <string-array name="dream_timeout_entries">
     <item msgid="3149294732238283185">"  "</item>

vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/arrays.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/arrays.xml
@@ -48,6 +48,7 @@
         <item>5 minutes</item>
         <item>10 minutes</item>
         <item>30 minutes</item>
+        <item>never</item>
     </string-array>
 
     <!-- Do not translate. -->
@@ -66,6 +67,8 @@
         <item>600000</item>
         <!-- Do not translate. -->
         <item>1800000</item>
+        <!-- MAX. -->
+        <item>2147483647</item>
     </string-array>

Android 8.1 vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/display/TimeoutPreferenceController.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/display/TimeoutPreferenceController.java
@@ -111,7 +111,11 @@ public class TimeoutPreferenceController extends AbstractPreferenceController im
         } else {
             final CharSequence timeoutDescription = getTimeoutDescription(
                     currentTimeout, entries, values);
-            summary = timeoutDescription == null
+            //cczheng add for show never sleep
+            if (currentTimeout == Integer.MAX_VALUE)
+                summary = entries[entries.length-1].toString();
+            else
+                summary = timeoutDescription == null
                     ? ""
                     : mContext.getString(R.string.screen_timeout_summary, timeoutDescription);
         }


Android6.0 packages\apps\Settings\src\com\android\settings\DisplaySettings.java
private void updateTimeoutPreferenceDescription(long currentTimeout) {
        ListPreference preference = mScreenTimeoutPreference;
        String summary;
        if (currentTimeout < 0) {
            // Unsupported value
            summary = "";
        } else {
            final CharSequence[] entries = preference.getEntries();
            final CharSequence[] values = preference.getEntryValues();
            if (entries == null || entries.length == 0) {
                summary = "";
            } else {
                int best = 0;
                for (int i = 0; i < values.length; i++) {
                    long timeout = Long.parseLong(values[i].toString());
                    if (currentTimeout >= timeout) {
                        best = i;
                    }
                }
                //cczheng add for show never sleep
                if (currentTimeout == Integer.MAX_VALUE)
                    summary = entries[best].toString();
                else
                    summary = preference.getContext().getString(R.string.screen_timeout_summary,
                        entries[best]);
            }
        }
        preference.setSummary(summary);
    }


6、Launcherのhotseat自動上下ジャンプ
vendormediatekproprietarypackagesappsLauncher 3srccomandroidlauncher 3Launcher.java注釈onResume()の次の方法
 @Override
    protected void onResume() {
        long startTime = 0;
        	....
		/*if (shouldShowDiscoveryBounce()) {
            mAllAppsController.showDiscoveryBounce();
        }*/


7、非システムダイヤル応用コール緊急番号は直接呼び出し、Dialerにジャンプしない
vendor\mediatek\proprietary\packages\services\Telecomm\src\com\android\server\telecom\NewOutgoingCallIntentBroadcaster.java
mIsDefaultOrSystemPhoneApp判定の除去
    @VisibleForTesting
    public int processIntent() {
        Log.v(this, "Processing call intent in OutgoingCallIntentBroadcaster.");

		....

		if (Intent.ACTION_CALL.equals(action)) {
            if (isPotentialEmergencyNumber) {
                //cczheng remove the default Dialer islaunched when call an EmergencyNumber
                /*if (!mIsDefaultOrSystemPhoneApp) {
                    Log.w(this, "Cannot call potential emergency number %s with CALL Intent %s "
                            + "unless caller is system or default dialer.", number, intent);
                    launchSystemDialer(intent.getData());
                    return DisconnectCause.OUTGOING_CANCELED;
                } else {*/
                    callImmediately = true;
                //}
            }
        } else if (Intent.ACTION_CALL_EMERGENCY.equals(action)) {
		......


8、vlote電話自動音声電話通知
vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\InCallActivity.java
private String lastUIScreenShow;
  private String currentUIScreen;
  private void showMainInCallFragment() {
    // If the activity's onStart method hasn't been called yet then defer doing any work.
    if (!isVisible) {
      LogUtil.i("InCallActivity.showMainInCallFragment", "not visible yet/anymore");
      return;
    }

    // Don't let this be reentrant.
    if (isInShowMainInCallFragment) {
      LogUtil.i("InCallActivity.showMainInCallFragment", "already in method, bailing");
      return;
    }

    isInShowMainInCallFragment = true;
    ShouldShowUiResult shouldShowAnswerUi = getShouldShowAnswerUi();
    ShouldShowUiResult shouldShowVideoUi = getShouldShowVideoUi();
    LogUtil.d(
        "InCallActivity.showMainInCallFragment",
        "shouldShowAnswerUi: %b, shouldShowVideoUi: %b, "
            + "didShowAnswerScreen: %b, didShowInCallScreen: %b, didShowVideoCallScreen: %b",
        shouldShowAnswerUi.shouldShow,
        shouldShowVideoUi.shouldShow,
        didShowAnswerScreen,
        didShowInCallScreen,
        didShowVideoCallScreen);
     android.util.Log.i(
        "InCallActivity.showMainInCallFragment",
        String.format("shouldShowAnswerUi: %b, shouldShowVideoUi: %b, "
            + "didShowAnswerScreen: %b, didShowInCallScreen: %b, didShowVideoCallScreen: %b",
        shouldShowAnswerUi.shouldShow,
        shouldShowVideoUi.shouldShow,
        didShowAnswerScreen,
        didShowInCallScreen,
        didShowVideoCallScreen));
    /// M:[ALPS03482828] modify allow orientation conditions.incallactivity and videocallpresenter
    ///have conflicts on allow orientation.keep incallactivity and videocallpresenter have same
    ///conditions. @{
    /// Google original code:@{
    // Only video call ui allows orientation change.
    //setAllowOrientationChange(shouldShowVideoUi.shouldShow);
    ///@}
    setAllowOrientationChange(isAllowOrientation(shouldShowAnswerUi,shouldShowVideoUi));
    ///@}
    /// M:ALPS03538860 clear rotation when disable incallOrientationEventListner.@{
    common.checkResetOrientation();
    ///@}
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    boolean didChangeInCall;
    boolean didChangeVideo;
    boolean didChangeAnswer;
    if (shouldShowAnswerUi.shouldShow) {
       currentUIScreen = "answercall";
      LogUtil.d("showMainInCallFragment", "showAnswerScreenFragment");
      didChangeInCall = hideInCallScreenFragment(transaction);
      didChangeVideo = hideVideoCallScreenFragment(transaction);
      didChangeAnswer = showAnswerScreenFragment(transaction, shouldShowAnswerUi.call);
    } else if (shouldShowVideoUi.shouldShow) {
       currentUIScreen = "videocall";
      LogUtil.d("showMainInCallFragment", "showVideoCallScreenFragment");
      didChangeInCall = hideInCallScreenFragment(transaction);
      didChangeVideo = showVideoCallScreenFragment(transaction, shouldShowVideoUi.call);
      didChangeAnswer = hideAnswerScreenFragment(transaction);
    /// M: Hide incall screen when exist waiting account call. @{
    } else if (CallList.getInstance().getWaitingForAccountCall() != null) {
       currentUIScreen = "nocall";
      LogUtil.d("showMainInCallFragment", "hide all");
      didChangeInCall = hideInCallScreenFragment(transaction);
      didChangeVideo = hideVideoCallScreenFragment(transaction);
      didChangeAnswer = hideAnswerScreenFragment(transaction);
    /// @}
    } else {
      currentUIScreen = "incall";
       LogUtil.d("showMainInCallFragment", "showInCallScreenFragment");
      didChangeInCall = showInCallScreenFragment(transaction);
      didChangeVideo = hideVideoCallScreenFragment(transaction);
      didChangeAnswer = hideAnswerScreenFragment(transaction);
    }

    //voltecall no support auto change voicecall
    if ("videocall".equals(lastUIScreenShow) && "incall".equals(currentUIScreen)) {
       LogUtil.i("showMainInCallFragment", "voltecall---->voicecall");
       sendBroadcast(new Intent("com.android.incall.volte2voice").addFlags(0x01000000));
    }

    if (didChangeInCall || didChangeVideo || didChangeAnswer) {
      transaction.commitNow();
      Logger.get(this).logScreenView(ScreenEvent.Type.INCALL, this);
    }
    isInShowMainInCallFragment = false;

    lastUIScreenShow = currentUIScreen;
  }

9、vloteブラシ後の初回着信ページにプレビュー権限が表示されない問題
vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/videotech/utils/VideoUtils.java
@@ -50,7 +50,8 @@ public class VideoUtils {
     ///choose. so incallui will set camera is null to vtservice.VTservice will get stuck. @{
     return isTestSim() ? hasCameraPermission(context) :
     ///@}
-           (PermissionsUtil.hasCameraPrivacyToastShown(context) && hasCameraPermission(context));
+           (/*PermissionsUtil.hasCameraPrivacyToastShown(context) &&*/ hasCameraPermission(context));
+// annotaion for first don't show Video is off,don't toast tell have open camera permission
   }
 
   public static boolean hasCameraPermission(@NonNull Context context) {

10、Dialer通話インタフェース背景色ランダム切替問題、修正デフォルトは青
vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/ThemeColorManager.java
@@ -97,14 +97,17 @@ public class ThemeColorManager {
       backgroundColorMiddle = context.getColor(R.color.incall_background_gradient_middle);
       backgroundColorBottom = context.getColor(R.color.incall_background_gradient_bottom);
       backgroundColorSolid = context.getColor(R.color.incall_background_multiwindow);
-      if (highlightColor != PhoneAccount.NO_HIGHLIGHT_COLOR) {
+      android.util.Log.e("ccd","updateThemeColors() ="+ (highlightColor != PhoneAccount.NO_HIGHLIGHT_COLOR));
+      //annotation for incallbg show blue not green
+      //IncallActivity updateWindowBackgroundColor()
+      /*if (highlightColor != PhoneAccount.NO_HIGHLIGHT_COLOR) {
         // The default background gradient has a subtle alpha. We grab that alpha and apply it to
         // the phone account color.
         backgroundColorTop = applyAlpha(palette.mPrimaryColor, backgroundColorTop);
         backgroundColorMiddle = applyAlpha(palette.mPrimaryColor, backgroundColorMiddle);
         backgroundColorBottom = applyAlpha(palette.mPrimaryColor, backgroundColorBottom);
         backgroundColorSolid = applyAlpha(palette.mPrimaryColor, backgroundColorSolid);
-      }
+      }*/
     }
 
     primaryColor = palette.mPrimaryColor;

11、Volte通話画面プレビュー画像ストレッチバグ修正
プレビューの幅を設定する方法はVideoCallFragmentで
vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\video\impl\VideoCallFragment.java
private void updatePreviewVideoScaling() {
    if (previewTextureView.getWidth() == 0 || previewTextureView.getHeight() == 0) {
      LogUtil.i("VideoCallFragment.updatePreviewVideoScaling", "view layout hasn't finished yet");
      return;
    }
    VideoSurfaceTexture localVideoSurfaceTexture =
        videoCallScreenDelegate.getLocalVideoSurfaceTexture();
    Point cameraDimensions = localVideoSurfaceTexture.getSurfaceDimensions();

	....}

private void updateRemoteVideoScaling() {
    VideoSurfaceTexture remoteVideoSurfaceTexture =
        videoCallScreenDelegate.getRemoteVideoSurfaceTexture();
    Point videoSize = remoteVideoSurfaceTexture.getSourceVideoDimensions();
    if (videoSize == null) {
      LogUtil.i("VideoCallFragment.updateRemoteVideoScaling", "video size is null");
      return;
    }
    if (remoteTextureView.getWidth() == 0 || remoteTextureView.getHeight() == 0) {
      LogUtil.i("VideoCallFragment.updateRemoteVideoScaling", "view layout hasn't finished yet");
      return;
    }

    // If the video and display aspect ratio's are close then scale video to fill display
    float videoAspectRatio = ((float) videoSize.x) / videoSize.y;
    float displayAspectRatio =
        ((float) remoteTextureView.getWidth()) / remoteTextureView.getHeight();
    float delta = Math.abs(videoAspectRatio - displayAspectRatio);


最終的には実際にはVideoSCaleでは、幅を大きくすることでスケールを変更します.
vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\videosurface\impl\VideoScale.java
public class VideoScale {
  /**
   * Scales the video in the given view such that the video takes up the entire view. To maintain
   * aspect ratio the video will be scaled to be larger than the view.
   */
  public static void scaleVideoAndFillView(
      TextureView textureView, float videoWidth, float videoHeight, float rotationDegrees) {
    // add for localPreView smaller bug
    if (videoWidth > videoHeight) {
      float tmpVideoWidth = videoWidth;
      videoWidth = videoHeight;
      videoHeight = tmpVideoWidth;
      LogUtil.i("VideoScale.scaleVideoAndFillView","need change width and height");
    }//E
    float viewWidth = textureView.getWidth();
    float viewHeight = textureView.getHeight();
    float viewAspectRatio = viewWidth / viewHeight;
    float videoAspectRatio = videoWidth / videoHeight;
    float scaleWidth = 1.0f;
    float scaleHeight = 1.0f;

    if (viewAspectRatio > videoAspectRatio) {
      // Scale to exactly fit the width of the video. The top and bottom will be cropped.
      float scaleFactor = viewWidth / videoWidth;
      float desiredScaledHeight = videoHeight * scaleFactor;
      scaleHeight = desiredScaledHeight / viewHeight;
    } else {
      // Scale to exactly fit the height of the video. The sides will be cropped.
      float scaleFactor = viewHeight / videoHeight;
      float desiredScaledWidth = videoWidth * scaleFactor;
      scaleWidth = desiredScaledWidth / viewWidth;
    }

    if (rotationDegrees == 90.0f || rotationDegrees == 270.0f) {
      // We're in landscape mode but the camera feed is still drawing in portrait mode. Normally,
      // scale of 1.0 means that the video feed stretches to fit the view. In this case the X axis
      // is scaled to fit the height and the Y axis is scaled to fit the width.
      float scaleX = scaleWidth;
      float scaleY = scaleHeight;
      scaleWidth = viewHeight / viewWidth * scaleY;
      scaleHeight = viewWidth / viewHeight * scaleX;

      // This flips the view vertically. Without this the camera feed would be upside down.
      scaleWidth = scaleWidth * -1.0f;
      // This flips the view horizontally. Without this the camera feed would be mirrored (left
      // side would appear on right).
      scaleHeight = scaleHeight * -1.0f;
    }

    LogUtil.i(
        "VideoScale.scaleVideoAndFillView",
        "view: %f x %f, video: %f x %f scale: %f x %f, rotation: %f",
        viewWidth,
        viewHeight,
        videoWidth,
        videoHeight,
        scaleWidth,
        scaleHeight,
        rotationDegrees);

    Matrix transform = new Matrix();
    transform.setScale(
        scaleWidth,
        scaleHeight,
        // This performs the scaling from the horizontal middle of the view.
        viewWidth / 2.0f,
        // This perform the scaling from vertical middle of the view.
        viewHeight / 2.0f);
    if (rotationDegrees != 0) {
      transform.postRotate(rotationDegrees, viewWidth / 2.0f, viewHeight / 2.0f);
    }
    textureView.setTransform(transform);
  }