diff options
| author | 2020-04-06 12:15:03 +0800 | |
|---|---|---|
| committer | 2020-04-08 12:31:26 +0800 | |
| commit | fd2f5f66f9f35d0652f811408eafc35fd8e2d118 (patch) | |
| tree | b0d1274123b2ebaba3a2774cf258d04c48bc6a72 | |
| parent | 5b8c53ff0014bce719d24eaf1ed16c2aa4660bb0 (diff) | |
Enable System User Home for CSI
Core system image (CSI) doesn't have Launcher or Settings so no home
activity, but still needs to boot properly. This change enables the
fallback home activity, SystemUserHome, in the framework for CSI.
Bug: 149307007
Bug: 149780604
Test: $ lunch csi_arm64-userdebug; m
# flash the system.img built to crosshatch
$ atest DeviceHealthTests
Change-Id: I0f999f76e23c6316f6d5d0741a1116028e34a0ab
4 files changed, 66 insertions, 1 deletions
diff --git a/core/java/com/android/internal/app/SystemUserHomeActivity.java b/core/java/com/android/internal/app/SystemUserHomeActivity.java index 26fbf6f826a8..ee936a3f9abc 100644 --- a/core/java/com/android/internal/app/SystemUserHomeActivity.java +++ b/core/java/com/android/internal/app/SystemUserHomeActivity.java @@ -17,10 +17,27 @@ package com.android.internal.app; import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +import com.android.internal.R; /** * Placeholder home activity, which is always installed on the system user. At least one home * activity must be present and enabled in order for the system to boot. */ public class SystemUserHomeActivity extends Activity { + private static final String TAG = "SystemUserHome"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Log.i(TAG, "onCreate"); + setContentView(R.layout.system_user_home); + } + + protected void onDestroy() { + super.onDestroy(); + Log.i(TAG, "onDestroy"); + } } diff --git a/core/res/res/layout/system_user_home.xml b/core/res/res/layout/system_user_home.xml new file mode 100644 index 000000000000..8afa42338e36 --- /dev/null +++ b/core/res/res/layout/system_user_home.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2020 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#80000000" + android:forceHasOverlappingRendering="false"> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_gravity="center" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="20sp" + android:textColor="?android:attr/textColorPrimary" + android:text="Framework Fallback Home"/> + <ProgressBar + style="@android:style/Widget.Material.ProgressBar.Horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="12.75dp" + android:colorControlActivated="?android:attr/textColorPrimary" + android:indeterminate="true"/> + </LinearLayout> +</FrameLayout> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ef1e8b74b05f..1c851d6a89f2 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1468,6 +1468,7 @@ <java-symbol type="layout" name="select_dialog" /> <java-symbol type="layout" name="simple_dropdown_hint" /> <java-symbol type="layout" name="status_bar_latest_event_content" /> + <java-symbol type="layout" name="system_user_home" /> <java-symbol type="layout" name="text_edit_action_popup_text" /> <java-symbol type="layout" name="text_drag_thumbnail" /> <java-symbol type="layout" name="typing_filter" /> diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index e41ba0e1745d..2a9f503602ac 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -465,6 +465,8 @@ public class ActivityManagerService extends IActivityManager.Stub static final String SYSTEM_DEBUGGABLE = "ro.debuggable"; + static final String SYSTEM_USER_HOME_NEEDED = "ro.system_user_home_needed"; + public static final String ANR_TRACE_DIR = "/data/anr"; // Maximum number of receivers an app can register. @@ -9592,7 +9594,8 @@ public class ActivityManagerService extends IActivityManager.Stub // to handle home activity in this case. if (UserManager.isSplitSystemUser() && Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.USER_SETUP_COMPLETE, 0) != 0) { + Settings.Secure.USER_SETUP_COMPLETE, 0) != 0 + || SystemProperties.getBoolean(SYSTEM_USER_HOME_NEEDED, false)) { t.traceBegin("enableHomeActivity"); ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class); try { |