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

Commit 2ef71f75 authored by Chilun's avatar Chilun
Browse files

Add secondary launcher mechanism (1/3)

Add a new config value for recording the component name of secondary
launcher.
This secondary launcher with corresponding launch mode set in
AndroidManifest could be used on secondary displays that support system
decorations.
OEMs can easily replace their own secondary launcher by overlay it.

Bug: 118206886
Bug: 111363427
Test: atest RootActivityContainerTests
Test: atest ActivityManagerMultiDisplayTests
Change-Id: Iceab096fd369127231f2085313ee617c7cdea226
parent 6dd78526
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10268,6 +10268,7 @@ package android.content {
    field public static final java.lang.String CATEGORY_OPENABLE = "android.intent.category.OPENABLE";
    field public static final java.lang.String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE";
    field public static final java.lang.String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE";
    field public static final java.lang.String CATEGORY_SECONDARY_HOME = "android.intent.category.SECONDARY_HOME";
    field public static final java.lang.String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE";
    field public static final java.lang.String CATEGORY_TAB = "android.intent.category.TAB";
    field public static final java.lang.String CATEGORY_TEST = "android.intent.category.TEST";
+5 −0
Original line number Diff line number Diff line
@@ -4221,6 +4221,11 @@ public class Intent implements Parcelable, Cloneable {
     */
    @SdkConstant(SdkConstantType.INTENT_CATEGORY)
    public static final String CATEGORY_HOME_MAIN = "android.intent.category.HOME_MAIN";
    /**
     * The home activity shown on secondary displays that support showing home activities.
     */
    @SdkConstant(SdkConstantType.INTENT_CATEGORY)
    public static final String CATEGORY_SECONDARY_HOME = "android.intent.category.SECONDARY_HOME";
    /**
     * This is the setup wizard activity, that is the first activity that is displayed
     * when the user sets up the device for the first time.
+7 −0
Original line number Diff line number Diff line
@@ -3646,4 +3646,11 @@

    <!-- Component name for the default module metadata provider on this device -->
    <string name="config_defaultModuleMetadataProvider">com.android.modulemetadata</string>

    <!-- This is the default launcher component to use on secondary displays that support system
         decorations.
         This launcher activity must support multiple instances and have corresponding launch mode
         set in AndroidManifest.
         {@see android.view.Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS} -->
    <string name="config_secondaryHomeComponent" translatable="false">com.android.launcher3/com.android.launcher3.SecondaryDisplayLauncher</string>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -3522,4 +3522,7 @@
  <java-symbol type="dimen" name="rounded_corner_radius_bottom" />

  <java-symbol type="string" name="config_defaultModuleMetadataProvider" />

  <!-- For Secondary Launcher -->
  <java-symbol type="string" name="config_secondaryHomeComponent" />
</resources>
+3 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import static android.app.WindowConfiguration.activityTypeToString;
import static android.content.Intent.ACTION_MAIN;
import static android.content.Intent.CATEGORY_HOME;
import static android.content.Intent.CATEGORY_LAUNCHER;
import static android.content.Intent.CATEGORY_SECONDARY_HOME;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NO_HISTORY;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
@@ -1178,7 +1179,8 @@ final class ActivityRecord extends ConfigurationContainer {

    private boolean isHomeIntent(Intent intent) {
        return ACTION_MAIN.equals(intent.getAction())
                && intent.hasCategory(CATEGORY_HOME)
                && (intent.hasCategory(CATEGORY_HOME)
                || intent.hasCategory(CATEGORY_SECONDARY_HOME))
                && intent.getCategories().size() == 1
                && intent.getData() == null
                && intent.getType() == null;
Loading