Android(安卓)源码热门改动速查(持续更新.....)
1、8.1 默认音量调整
frameworks\base\media\java\android\media\AudioSystem.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(); } }
如要替换触摸提示音可至路径 frameworks\base\data\sounds\effects\Effect_Tick.ogg
4、修改系统默认字体大小
查看系统支持的字体大小范围
vendor\mediatek\proprietary\packages\apps\MtkSettings\res\values\arrays.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>
以下三处地方的改动,请根据实际生效情况而定
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 自动上下跳动
vendor\mediatek\proprietary\packages\apps\Launcher3\src\com\android\launcher3\Launcher.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 通话界面预览图像拉伸bug修改
设置预览宽高的方法在 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); }
更多相关文章
- android摄像头采集和预览-第二种方法
- 修改ListView 分割线Seperator line
- Android(安卓)修改横屏角度为顺时针270度
- 修改Button的样式!
- 修改air for android Manifest.xml下默认的screenOrientation
- 修改android virtual device路径
- 14条Android(安卓)Studio常用的的配置
- android tabhost --android UI 学习
- Android(安卓)Studio 文件类型图标