Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c40e244b authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Added a placeholder home activity for system user

Standard launcher can be uninstalled for system user. A low priority
placeholder home activity is used to make sure the system can always
boot. By default the component is disabled for all users, and is only enabled
for the system user at boot time.

Bug: 25726710
Change-Id: I97eed02c9e2bbd69a737cc1d203110bed837b803
parent c2138c54
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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
 */

package com.android.internal.app;

import android.app.Activity;

/**
 * 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 {
}
+11 −0
Original line number Diff line number Diff line
@@ -2835,6 +2835,17 @@
                android:process=":ui">
        </activity>

        <activity android:name="com.android.internal.app.SystemUserHomeActivity"
                  android:enabled="false"
                  android:process=":ui"
                  android:systemUserOnly="true"
                  android:theme="@style/Theme.Translucent.NoTitleBar">
            <intent-filter android:priority="-100">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
            </intent-filter>
        </activity>

        <receiver android:name="com.android.server.BootReceiver"
                android:systemUserOnly="true">
            <intent-filter android:priority="1000">
+12 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.internal.app.IAppOpsService;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.app.ProcessMap;
import com.android.internal.app.ProcessStats;
import com.android.internal.app.SystemUserHomeActivity;
import com.android.internal.os.BackgroundThread;
import com.android.internal.os.BatteryStatsImpl;
import com.android.internal.os.IResultReceiver;
@@ -12268,6 +12269,17 @@ public final class ActivityManagerService extends ActivityManagerNative
            // Start up initial activity.
            mBooting = true;
            // Enable home activity for system user, so that the system can always boot
            if (UserManager.isSplitSystemUser()) {
                ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class);
                try {
                    AppGlobals.getPackageManager().setComponentEnabledSetting(cName,
                            PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0,
                            UserHandle.USER_SYSTEM);
                } catch (RemoteException e) {
                    e.rethrowAsRuntimeException();
                }
            }
            startHomeActivityLocked(currentUserId, "systemReady");
            try {