Android framwork一些常见的修改
-
默认中文
/build/target/product/core_base.mk PRODUCT_PROPERTY_OVERRIDES := \ ro.config.notification_sound=OnTheHunt.ogg \ ro.config.alarm_alert=Alarm_Classic.ogg \ + persist.sys.language=zh \ + persist.sys.country=CN
-
添加默认中文输入法(Google拼音)
将下载的google拼音输入法放在
\vendor\rockchip\common\apps\GooglePinyin\GooglePinyin.apk
目录下,
新建\vendor\rockchip\common\apps\GooglePinyin\Android.mk
############################################################################### # GooglePinyin LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := GooglePinyin LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_TAGS := optional LOCAL_BUILT_MODULE_STEM := package.apk LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) #LOCAL_PRIVILEGED_MODULE := LOCAL_CERTIFICATE := PRESIGNED #LOCAL_OVERRIDES_PACKAGES := LOCAL_SRC_FILES := $(LOCAL_MODULE).apk #LOCAL_REQUIRED_MODULES := #LOCAL_PREBUILT_JNI_LIBS := include $(BUILD_PREBUILT)
# vendor/rockchip/common diff --git a/apps/apps.mk b/apps/apps.mk index 258e65f..3e58184 100755 --- a/apps/apps.mk +++ b/apps/apps.mk @@ -1,7 +1,8 @@ PRODUCT_PACKAGES += \ - RKUpdateService + RKUpdateService \ + GooglePinyin ifeq ($(strip $(TARGET_BOARD_HARDWARE)), rk30board) ifeq ($(strip $(TARGET_ARCH)), arm)
# frameworks/base packages/SettingsProvider/res/values/defaults.xml diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 94758c3..218a38a 100755 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -225,4 +225,6 @@ <integer name="def_screenshot_button_show">1</integer> <!-- the store location of screen capture by default--> <string name="def_screenshot_location">internal_storage</string> + + <string name="config_default_input_method" translatable="false">com.android.inputmethod.pinyin/.PinyinIME</string> </resources>
# frameworks/base packages/SettingsProvider/src/com/android/providers/settings//DatabaseHelper.java diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java old mode 100644 new mode 100755 index 5e2114d..740ce6a --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -2526,6 +2526,10 @@ class DatabaseHelper extends SQLiteOpenHelper { loadStringSetting(stmt, Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS, R.string.def_immersive_mode_confirmations); + + //add default input methods + loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS, + R.string.config_default_input_method); loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, R.bool.def_install_non_market_apps);
-
默认不休眠,不锁屏(将休眠时间设置为无限大[2^31-1])
# framwork/base diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index f4cefc2..43ef213 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -18,7 +18,7 @@ --> <resources> <bool name="def_dim_screen">true</bool> - <integer name="def_screen_off_timeout">60000</integer> + <integer name="def_screen_off_timeout">2147483647</integer> <integer name="def_sleep_timeout">-1</integer> <bool name="def_airplane_mode_on">false</bool> <bool name="def_theater_mode_on">false</bool> @@ -80,7 +80,7 @@ <string name="def_trusted_sound" translatable="false">/system/media/audio/ui/Trusted.ogg</string> <string name="def_wireless_charging_started_sound" translatable="false">/system/media/audio/ui/WirelessChargingStarted.ogg</string> - <bool name="def_lockscreen_disabled">false</bool> + <bool name="def_lockscreen_disabled">true</bool> <bool name="def_device_provisioned">false</bool> <integer name="def_dock_audio_media_enabled">1</integer>
-
屏幕物理方向修改
修改
device/rockchip/rk3399/(所选lunch目录)/system.prop
# 0 90 180 270 ro.sf.hwrotation=90
-
屏幕密度修改
修改
device/rockchip/rk3399/(所选lunch目录)/system.prop
ro.sf.lcd_density=160
-
去除
StatusBar
或者NavigatorBar
# frameworks/base/packages/SystemUI diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java old mode 100644 new mode 100755 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java old mode 100644 new mode 100755 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index f55d1f7..3682cb0 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -41,6 +41,7 @@ import android.app.IActivityManager; import android.app.Notification; import android.app.PendingIntent; import android.app.StatusBarManager; +import android.app.AlarmManager; import android.content.BroadcastReceiver; import android.content.ComponentCallbacks2; import android.content.ComponentName; @@ -285,6 +286,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, */ private static final int REMOTE_INPUT_KEPT_ENTRY_AUTO_CANCEL_DELAY = 200; + private static final String ACTION_NAVIGATION_BAR = "com.android.NavigationBarReceiver"; /** * Never let the alpha become zero for surfaces that draw with SRC - otherwise the RenderNode * won't draw anything and uninitialized memory will show through*/ @@ -1013,6 +1016,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); + filter.addAction(ACTION_NAVIGATION_BAR); context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null); IntentFilter demoFilter = new IntentFilter(); @@ -3667,6 +3672,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } else if (DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG.equals(action)) { mQSPanel.showDeviceMonitoringDialog(); + }else if (ACTION_NAVIGATION_BAR.equals(action)){ + try { + boolean show = intent.getBooleanExtra("show", true); + if (show) { + displaySystemUI(); + } else { + hideSystemUI(); + } + } catch (Exception e) { + e.printStackTrace(); + } } } }; @@ -5296,4 +5315,31 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } } + + public void hideSystemUI() { + if (mNavigationBarView != null && mNavigationBarView.isAttachedToWindow()) { + mWindowManager.removeViewImmediate(mNavigationBarView); + mNavigationBarView = null; + } + + if (mStatusBarWindow != null && mStatusBarWindow.isAttachedToWindow()) { + getBouncerContainer().setVisibility(View.GONE); + } + } + + public void displaySystemUI() { + if (mNavigationBarView == null) { + mHandler.post(new Runnable() { + @Override + public void run() { + final Context context = mContext; + createNavigationBarView(context); + addNavigationBar(); + } + }); + } + + if (mStatusBarWindow != null && mStatusBarWindow.isAttachedToWindow()) { + getBouncerContainer().setVisibility(View.VISIBLE); + } + } }
-
系统默认时间修改(一般默认为1970年)
# frameworks/base diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java old mode 100644 new mode 100755 index 393f062..0d16f48 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -123,11 +123,13 @@ public final class SystemServer { // The earliest supported time. We pick one day into 1970, to // give any timezone code room without going into negative time. - private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000; + // private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000; + // The earliest supported time change to 2018/09/01 1358473528234 + private static final long EARLIEST_SUPPORTED_TIME = 1535760000000L; /* - * Implementation class names. TODO: Move them to a codegen class or load - * them from the build system somehow. + * Implementation class names. TODO: Move them to a codegen class or load them + * from the build system somehow. */ private static final String BACKUP_MANAGER_SERVICE_CLASS = "com.android.server.backup.BackupManagerService$Lifecycle"; @@ -235,14 +237,7 @@ public final class SystemServer { private void run() { try { Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "InitBeforeStartServices"); - // If a device's clock is before 1970 (before 0), a lot of - // APIs crash dealing with negative numbers, notably - // java.io.File#setLastModified, so instead we fake it and - // hope that time from cell towers or NTP fixes it shortly. - if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) { - Slog.w(TAG, "System clock is before 1970; setting to 1970."); - SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME); - } + // If the system has "persist.sys.language" and friends set, replace them with // "persist.sys.locale". Note that the default locale at this point is calculated @@ -341,6 +336,20 @@ public final class SystemServer { startBootstrapServices(); startCoreServices(); startOtherServices(); + + // If a device's clock is before 1970 (before 0), a lot of + // APIs crash dealing with negative numbers, notably + // java.io.File#setLastModified, so instead we fake it and + // hope that time from cell towers or NTP fixes it shortly. + Slog.w(TAG, "System.currentTimeMillis(): " + System.currentTimeMillis() + " EARLIEST_SUPPORTED_TIME: " + + EARLIEST_SUPPORTED_TIME); + if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) { + Slog.w(TAG, "System clock is before 2018; setting to 2018."); + SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME); + } + + Slog.w(TAG, "System.currentTimeMillis(): " + System.currentTimeMillis() + " EARLIEST_SUPPORTED_TIME: " + + EARLIEST_SUPPORTED_TIME); } catch (Throwable ex) { Slog.e("System", "******************************************"); Slog.e("System", "************ Failure starting system services", ex);
-
修改开机Launcher为自己的app
# /frameworks/base/services diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 9fbd87d..621db11 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -4082,6 +4082,25 @@ public final class ActivityManagerService extends ActivityManagerNative Intent intent = getHomeIntent(); ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId); if (aInfo != null) { + + //add eyesdetector launcher start + PackageManager pm = mContext.getPackageManager(); + Intent newintent = new Intent(Intent.ACTION_MAIN); + newintent.addCategory(Intent.CATEGORY_HOME); + + List<ResolveInfo> resolveInfoList = pm.queryIntentActivities(newintent, 0); + //判断带有Intent.CATEGORY_HOME标签的所有activity中如果有你指定的activity则替换 + if(resolveInfoList != null){ + int size = resolveInfoList.size(); + for(int i = 0; i < size; i++){ + ResolveInfo rInfo = resolveInfoList.get(i); + if(rInfo.activityInfo.name.equals("com.qytech.eyesdetector.home.MainActivity")){ + aInfo = rInfo.activityInfo; + break; + } + } + } + //add eyesdetector launcher stop + intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name)); // Don't do this if the home app is currently being // instrumented.
-
取消usb授权弹窗
# frameworks/base/packages/SystemUI diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java old mode 100644 new mode 100755 index 1e69fc5..ec61b66 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java @@ -110,8 +110,9 @@ public class UsbPermissionActivity extends AlertActivity com.android.internal.R.id.clearDefaultHint); mClearDefaultHint.setVisibility(View.GONE); - setupAlert(); - + //setupAlert(); + mPermissionGranted = true; + finish(); }
-
默认允许安装不是从应用市场下载的apk
# frameworks/base diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 43ef213..3667b36 100755 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -38,7 +38,7 @@ <bool name="def_bluetooth_on">false</bool> <bool name="def_wifi_display_on">false</bool> - <bool name="def_install_non_market_apps">false</bool> + <bool name="def_install_non_market_apps">true</bool> <bool name="def_package_verifier_enable">true</bool> <!-- Comma-separated list of location providers. Network location is off by default because it requires
-
禁止状态栏下拉
# frameworks/base/packages/SystemUI diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java old mode 100644 new mode 100755 index 47ea59e..bf06f6a --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -59,6 +59,7 @@ import com.android.systemui.statusbar.DragDownHelper; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; +import android.os.SystemProperties; public class StatusBarWindowView extends FrameLayout { public static final String TAG = "StatusBarWindowView"; @@ -243,6 +244,10 @@ public class StatusBarWindowView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { + if (SystemProperties.getBoolean("persist.sys.disdropstatusbar", true)) { + return true; + } + boolean intercept = false; if (mNotificationPanel.isFullyExpanded() && mStackScrollLayout.getVisibility() == View.VISIBLE
-
待续
网友评论