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
This commit is contained in:
Isaac Chen
2020-04-06 12:15:03 +08:00
parent 5b8c53ff00
commit fd2f5f66f9
4 changed files with 66 additions and 1 deletions

View File

@@ -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");
}
}

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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 {