< >
平台
RK3128 + Android 7.1
目标
- 使用Launcher3
- 显示状态栏和导航栏
- 把TvSettings替换为Settings
原图:
最终效果:
1. 模块整理
主要是增删一些编译模块, 如, 删除TvSettings, 加上Settings
device/rockchip/common/tv/tv_base.mk
device/rockchip/rk312x/device.mk
vendor/rockchip/common/apps/apps.mk
删除模块: RKTvLauncher MediaCenter TvProvider TvSettings rkmcapp-armeabi-v7a-debug
增加: Launcher3 RKVideoPlayer RkExplorer
2. Launcher3
Launcher3编译不出来, 检查下这几个OVERLAY
将对应的模块从配置中删除, 或直接注释掉.
./vendor/rockchip/common/apps/RockVRHome/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/RKTvLauncher/Android.mk:#LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/MediaCenter/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/itvlauncher/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/ChangeLedStatus/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
Launcher3 启动不了
- am start -a android.intent.action.MAIN 不出现选择列表
主要原因是系统初始化未完成, 仅能显示android:directBootAware属性的APP, 这个后面再说
- am start -n com.android.launcher3/.Launcher 崩溃, 且LOG很少
1970-01-01 08:01:06.113 1039-1113/com.android.launcher3 W/WallpaperManager: WallpaperService not running
1970-01-01 08:01:06.121 1039-1113/com.android.launcher3 E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-2
Process: com.android.launcher3, PID: 1039
DeadSystemException: The system died; earlier logs will point to the root cause
- 安装第三方NovaLauncher一样不能正常启动.
2和3是由于缺少壁纸服务导致, 解决方法有两种.
- 修改frameworks/base/services/java/com/android/server/SystemServer.java
if (!disableNonCoreServices/* && context.getResources().getBoolean(
R.bool.config_enableWallpaperService)*/) {
traceBeginAndSlog("StartWallpaperManagerService");
mSystemServiceManager.startService(WALLPAPER_SERVICE_CLASS);
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
}
- 修改配置: device/rockchip/common/tv/overlay/frameworks/base/core/res/res/values/config.xml
true
无法使用其它桌面: RKTvLauncher优先级设置为2, 高于Launcher3
rk3128_box:/ # dumpsys package com.rockchips.android.leanbacklauncher
Activity Resolver Table:
Non-Data Actions:
android.intent.action.MAIN:
cc04bd7 com.rockchips.android.leanbacklauncher/.MainActivity filter 5b7e55d
Action: "android.intent.action.MAIN"
Category: "android.intent.category.HOME"
Category: "android.intent.category.DEFAULT"
mPriority=2, mHasPartialTypes=false
AutoVerify=false
445fcc4 com.rockchips.android.leanbacklauncher/.DummyActivity filter ce29ea0
Action: "android.intent.action.MAIN"
Category: "android.intent.category.LEANBACK_LAUNCHER"
AutoVerify=false
com.rockchips.android.leanbacklauncher.SETTINGS:
86887ad com.rockchips.android.leanbacklauncher/.settings.HomeScreenSettingsActivity filter a1d2ed2
Action: "com.rockchips.android.leanbacklauncher.SETTINGS"
Category: "android.intent.category.DEFAULT"
AutoVerify=false
aa6aae2 com.rockchips.android.leanbacklauncher/.settings.FullScreenSettingsActivity filter b1d1ba3
Action: "com.rockchips.android.leanbacklauncher.SETTINGS"
Category: "android.intent.category.DEFAULT"
AutoVerify=false
如上mPriority=2
解决这个问题, 可以删除RkTvLauncher 或提高 Launcher3的优先级.
3. 卡Android动画
原因: 在服务启动完成的后, 执行**startHomeActivityLocked中, 找不到Activity:
ActivityManagerService.java
startHomeActivityLocked -> Slog.wtf(TAG, "No home screen found for " + intent, new Throwable());
PackageManagerService.java
//没有返回对应的Launcher组件.
PackageManagerService.resolveIntent
同样的, 和android:directBootAware有关系, 在MID的SDK中, 正常流程下, 这时候会启动设置中的FallbackHome
而在BOX的SDK中, Settings 中FallbackHome被删除了HOME属性, 导致启动后找不到Home…
缺少了
加上即可
android:excludeFromRecents="true"
android:screenOrientation="nosensor"
android:theme="@style/FallbackHome">
4. SystemUI
在BOX中, 状态栏和导航栏是不显示的, 修改以下代码让它显示出来:
修改组件,使用PhoneStatusBar: device/rockchip/common/tv/overlay/frameworks/base/packages/SystemUI/res/values/config.xml
com.android.systemui.statu***ar.phone.PhoneStatusBar
修改代码关于BOX的判断: frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
old mode 100644
new mode 100755
index da6265d..e8c6d84
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
@@ -87,9 +87,9 @@ public class SystemBars extends SystemUI implements ServiceMonitor.Callbacks {
private void createStatusBarFromConfig() {
if (DEBUG) Log.d(TAG, "createStatusBarFromConfig");
String clsName = mContext.getString(R.string.config_statusBarComponent);
- if ("box".equals(SystemProperties.get("ro.target.product", "tablet"))){
+ /*if ("box".equals(SystemProperties.get("ro.target.product", "tablet"))){
clsName = "com.android.systemui.statu***ar.tv.TvStatusBar";
- }
+ }*/
if (clsName == null || clsName.length() == 0) {
throw andLog("No status bar component configured", null);
}
修改布局高度:device/rockchip/common/tv/overlay/frameworks/base/core/res/res/values/dimens.xml
24dp
48dp
48dp
42dp
修改显示位置 frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 7dfc835..dd737ce 100755
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2088,7 +2088,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
// Allow the navigation bar to move on non-square small devices (phones).
- mNavigationBarCanMove = width != height && shortSizeDp < 600;
+ mNavigationBarCanMove = false;// width != height && shortSizeDp < 600;
mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
@@ -4524,6 +4524,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
private int navigationBarPosition(int displayWidth, int displayHeight, int displayRotation) {
+ if(true)return NAV_BAR_BOTTOM;
if (mNavigationBarCanMove && displayWidth > displayHeight) {
if (displayRotation == Surface.ROTATION_270) {
return NAV_BAR_LEFT;
@@ -8270,6 +8271,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
pw.print(" mForceClearedSystemUiFlags=0x");
pw.println(Integer.toHexString(mForceClearedSystemUiFlags));
}
+ pw.print(" token punctuation">); pw.print(mHasNavigationBar);
if (mLastFocusNeedsMenu) {
pw.print(prefix); pw.print("token punctuation">);
pw.println(mLastFocusNeedsMenu);
5. 壁纸
默认使用黑背景图片
device/rockchip/common/tv/overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png
6. 扩展
- 若不使用Settings的FallbackHome 而 直接使用Launcher3 开机, 需要做以下修改
diff --git a/packages/apps/Launcher3/Android.mk b/packages/apps/Launcher3/Android.mk
old mode 100644
new mode 100755
diff --git a/packages/apps/Launcher3/AndroidManifest.xml b/packages/apps/Launcher3/AndroidManifest.xml
old mode 100644
new mode 100755
index 6c5990d..7816dfb
--- a/packages/apps/Launcher3/AndroidManifest.xml
+++ b/packages/apps/Launcher3/AndroidManifest.xml
@@ -52,6 +52,7 @@
android:
android:
+ android:directBootAware="true"
android:
android:
android:
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java b/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java
old mode 100644
new mode 100755
index d3e5350..a4c5a3b
--- a/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java
@@ -62,7 +62,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
// have been established by this point, and we will end up populating the
// widgets upon bind anyway. See issue 14255011 for more context.
} else {
- throw new RuntimeException(e);
+ //throw new RuntimeException(e);
}
}
}
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java b/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java
index ffed8fc..39170d9 100755
--- a/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java
@@ -249,7 +249,10 @@ public class Q***ContainerView extends FrameLayout {
public static AppWidgetProviderInfo getSearchWidgetProvider(Context context) {
SearchManager searchManager =
(SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
- ComponentName searchComponent = searchManager.getGlobalSearchActivity();
+ ComponentName searchComponent = null;
+ try{
+ searchComponent = searchManager.getGlobalSearchActivity();
+ }catch(Exception ignore){}
if (searchComponent == null) return null;
String providerPkg = searchComponent.getPackageName();
主要解决
- AMS找不到Home导致卡动画问题.
- 启动Launcher3后自身崩溃问题, LOG如下:
Launcher3 崩溃
1970-01-01 08:01:05.414 2963-2963/com.android.launcher3 D/AndroidRuntime: Shutting down VM
1970-01-01 08:01:05.417 2963-2963/com.android.launcher3 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.launcher3, PID: 2963
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.launcher3/com.android.launcher3.Launcher}: java.lang.RuntimeException: java.lang.IllegalStateException: User 0 must be unlocked for widgets to be available
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: User 0 must be unlocked for widgets to be available
at com.android.launcher3.LauncherAppWidgetHost.startListening(LauncherAppWidgetHost.java:65)
at com.android.launcher3.Launcher.onCreate(Launcher.java:417)
at android.app.Activity.performCreate(Activity.java:6709)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Caused by: java.lang.IllegalStateException: User 0 must be unlocked for widgets to be available
at android.os.Parcel.readException(Parcel.java:1692)
at android.os.Parcel.readException(Parcel.java:1637)
at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.startListening(IAppWidgetService.java:494)
at android.appwidget.AppWidgetHost.startListening(AppWidgetHost.java:191)
at com.android.launcher3.LauncherAppWidgetHost.startListening(LauncherAppWidgetHost.java:56)
at com.android.launcher3.Launcher.onCreate(Launcher.java:417)
at android.app.Activity.performCreate(Activity.java:6709)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
"User " + userId + " must be unlocked for widgets to be available");
< >
平台
RK3128 + Android 7.1
目标
- 使用Launcher3
- 显示状态栏和导航栏
- 把TvSettings替换为Settings
原图:
最终效果:
1. 模块整理
主要是增删一些编译模块, 如, 删除TvSettings, 加上Settings
device/rockchip/common/tv/tv_base.mk
device/rockchip/rk312x/device.mk
vendor/rockchip/common/apps/apps.mk
删除模块: RKTvLauncher MediaCenter TvProvider TvSettings rkmcapp-armeabi-v7a-debug
增加: Launcher3 RKVideoPlayer RkExplorer
2. Launcher3
Launcher3编译不出来, 检查下这几个OVERLAY
将对应的模块从配置中删除, 或直接注释掉.
./vendor/rockchip/common/apps/RockVRHome/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/RKTvLauncher/Android.mk:#LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/MediaCenter/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/itvlauncher/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
./vendor/rockchip/common/apps/ChangeLedStatus/Android.mk:LOCAL_OVERRIDES_PACKAGES := Launcher3
Launcher3 启动不了
- am start -a android.intent.action.MAIN 不出现选择列表
主要原因是系统初始化未完成, 仅能显示android:directBootAware属性的APP, 这个后面再说
- am start -n com.android.launcher3/.Launcher 崩溃, 且LOG很少
1970-01-01 08:01:06.113 1039-1113/com.android.launcher3 W/WallpaperManager: WallpaperService not running
1970-01-01 08:01:06.121 1039-1113/com.android.launcher3 E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-2
Process: com.android.launcher3, PID: 1039
DeadSystemException: The system died; earlier logs will point to the root cause
- 安装第三方NovaLauncher一样不能正常启动.
2和3是由于缺少壁纸服务导致, 解决方法有两种.
- 修改frameworks/base/services/java/com/android/server/SystemServer.java
if (!disableNonCoreServices/* && context.getResources().getBoolean(
R.bool.config_enableWallpaperService)*/) {
traceBeginAndSlog("StartWallpaperManagerService");
mSystemServiceManager.startService(WALLPAPER_SERVICE_CLASS);
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
}
- 修改配置: device/rockchip/common/tv/overlay/frameworks/base/core/res/res/values/config.xml
true
无法使用其它桌面: RKTvLauncher优先级设置为2, 高于Launcher3
rk3128_box:/ # dumpsys package com.rockchips.android.leanbacklauncher
Activity Resolver Table:
Non-Data Actions:
android.intent.action.MAIN:
cc04bd7 com.rockchips.android.leanbacklauncher/.MainActivity filter 5b7e55d
Action: "android.intent.action.MAIN"
Category: "android.intent.category.HOME"
Category: "android.intent.category.DEFAULT"
mPriority=2, mHasPartialTypes=false
AutoVerify=false
445fcc4 com.rockchips.android.leanbacklauncher/.DummyActivity filter ce29ea0
Action: "android.intent.action.MAIN"
Category: "android.intent.category.LEANBACK_LAUNCHER"
AutoVerify=false
com.rockchips.android.leanbacklauncher.SETTINGS:
86887ad com.rockchips.android.leanbacklauncher/.settings.HomeScreenSettingsActivity filter a1d2ed2
Action: "com.rockchips.android.leanbacklauncher.SETTINGS"
Category: "android.intent.category.DEFAULT"
AutoVerify=false
aa6aae2 com.rockchips.android.leanbacklauncher/.settings.FullScreenSettingsActivity filter b1d1ba3
Action: "com.rockchips.android.leanbacklauncher.SETTINGS"
Category: "android.intent.category.DEFAULT"
AutoVerify=false
如上mPriority=2
解决这个问题, 可以删除RkTvLauncher 或提高 Launcher3的优先级.
3. 卡Android动画
原因: 在服务启动完成的后, 执行**startHomeActivityLocked中, 找不到Activity:
ActivityManagerService.java
startHomeActivityLocked -> Slog.wtf(TAG, "No home screen found for " + intent, new Throwable());
PackageManagerService.java
//没有返回对应的Launcher组件.
PackageManagerService.resolveIntent
同样的, 和android:directBootAware有关系, 在MID的SDK中, 正常流程下, 这时候会启动设置中的FallbackHome
而在BOX的SDK中, Settings 中FallbackHome被删除了HOME属性, 导致启动后找不到Home…
缺少了
加上即可
android:excludeFromRecents="true"
android:screenOrientation="nosensor"
android:theme="@style/FallbackHome">
4. SystemUI
在BOX中, 状态栏和导航栏是不显示的, 修改以下代码让它显示出来:
修改组件,使用PhoneStatusBar: device/rockchip/common/tv/overlay/frameworks/base/packages/SystemUI/res/values/config.xml
com.android.systemui.statu***ar.phone.PhoneStatusBar
修改代码关于BOX的判断: frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
old mode 100644
new mode 100755
index da6265d..e8c6d84
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statu***ar/SystemBars.java
@@ -87,9 +87,9 @@ public class SystemBars extends SystemUI implements ServiceMonitor.Callbacks {
private void createStatusBarFromConfig() {
if (DEBUG) Log.d(TAG, "createStatusBarFromConfig");
String clsName = mContext.getString(R.string.config_statusBarComponent);
- if ("box".equals(SystemProperties.get("ro.target.product", "tablet"))){
+ /*if ("box".equals(SystemProperties.get("ro.target.product", "tablet"))){
clsName = "com.android.systemui.statu***ar.tv.TvStatusBar";
- }
+ }*/
if (clsName == null || clsName.length() == 0) {
throw andLog("No status bar component configured", null);
}
修改布局高度:device/rockchip/common/tv/overlay/frameworks/base/core/res/res/values/dimens.xml
24dp
48dp
48dp
42dp
修改显示位置 frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 7dfc835..dd737ce 100755
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2088,7 +2088,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
// Allow the navigation bar to move on non-square small devices (phones).
- mNavigationBarCanMove = width != height && shortSizeDp < 600;
+ mNavigationBarCanMove = false;// width != height && shortSizeDp < 600;
mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
@@ -4524,6 +4524,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
private int navigationBarPosition(int displayWidth, int displayHeight, int displayRotation) {
+ if(true)return NAV_BAR_BOTTOM;
if (mNavigationBarCanMove && displayWidth > displayHeight) {
if (displayRotation == Surface.ROTATION_270) {
return NAV_BAR_LEFT;
@@ -8270,6 +8271,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
pw.print(" mForceClearedSystemUiFlags=0x");
pw.println(Integer.toHexString(mForceClearedSystemUiFlags));
}
+ pw.print(" token punctuation">); pw.print(mHasNavigationBar);
if (mLastFocusNeedsMenu) {
pw.print(prefix); pw.print("token punctuation">);
pw.println(mLastFocusNeedsMenu);
5. 壁纸
默认使用黑背景图片
device/rockchip/common/tv/overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png
6. 扩展
- 若不使用Settings的FallbackHome 而 直接使用Launcher3 开机, 需要做以下修改
diff --git a/packages/apps/Launcher3/Android.mk b/packages/apps/Launcher3/Android.mk
old mode 100644
new mode 100755
diff --git a/packages/apps/Launcher3/AndroidManifest.xml b/packages/apps/Launcher3/AndroidManifest.xml
old mode 100644
new mode 100755
index 6c5990d..7816dfb
--- a/packages/apps/Launcher3/AndroidManifest.xml
+++ b/packages/apps/Launcher3/AndroidManifest.xml
@@ -52,6 +52,7 @@
android:
android:
+ android:directBootAware="true"
android:
android:
android:
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java b/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java
old mode 100644
new mode 100755
index d3e5350..a4c5a3b
--- a/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/LauncherAppWidgetHost.java
@@ -62,7 +62,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
// have been established by this point, and we will end up populating the
// widgets upon bind anyway. See issue 14255011 for more context.
} else {
- throw new RuntimeException(e);
+ //throw new RuntimeException(e);
}
}
}
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java b/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java
index ffed8fc..39170d9 100755
--- a/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/Q***ContainerView.java
@@ -249,7 +249,10 @@ public class Q***ContainerView extends FrameLayout {
public static AppWidgetProviderInfo getSearchWidgetProvider(Context context) {
SearchManager searchManager =
(SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
- ComponentName searchComponent = searchManager.getGlobalSearchActivity();
+ ComponentName searchComponent = null;
+ try{
+ searchComponent = searchManager.getGlobalSearchActivity();
+ }catch(Exception ignore){}
if (searchComponent == null) return null;
String providerPkg = searchComponent.getPackageName();
主要解决
- AMS找不到Home导致卡动画问题.
- 启动Launcher3后自身崩溃问题, LOG如下:
Launcher3 崩溃
1970-01-01 08:01:05.414 2963-2963/com.android.launcher3 D/AndroidRuntime: Shutting down VM
1970-01-01 08:01:05.417 2963-2963/com.android.launcher3 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.launcher3, PID: 2963
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.launcher3/com.android.launcher3.Launcher}: java.lang.RuntimeException: java.lang.IllegalStateException: User 0 must be unlocked for widgets to be available
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: User 0 must be unlocked for widgets to be available
at com.android.launcher3.LauncherAppWidgetHost.startListening(LauncherAppWidgetHost.java:65)
at com.android.launcher3.Launcher.onCreate(Launcher.java:417)
at android.app.Activity.performCreate(Activity.java:6709)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Caused by: java.lang.IllegalStateException: User 0 must be unlocked for widgets to be available
at android.os.Parcel.readException(Parcel.java:1692)
at android.os.Parcel.readException(Parcel.java:1637)
at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.startListening(IAppWidgetService.java:494)
at android.appwidget.AppWidgetHost.startListening(AppWidgetHost.java:191)
at com.android.launcher3.LauncherAppWidgetHost.startListening(LauncherAppWidgetHost.java:56)
at com.android.launcher3.Launcher.onCreate(Launcher.java:417)
at android.app.Activity.performCreate(Activity.java:6709)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
frameworks/base/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
"User " + userId + " must be unlocked for widgets to be available");
举报