summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Louis Chang <louischang@google.com> 2025-02-23 15:45:01 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-23 15:45:01 -0800
commitc9aa38fc5a2e71f4960e6ebe3cb0b2a2496f99d2 (patch)
treefdee63bec9ebb076d85a8eae0f480d6e98539cd6
parent8d6b16476976f8cdace611e201f4f6ffd7faf137 (diff)
parentf207b00bc1eff76bc788f5a2578e3e3f2c960f6b (diff)
Merge "Remove normalize_home_intent flag" into main
-rw-r--r--core/java/android/window/flags/windowing_sdk.aconfig10
-rw-r--r--services/core/java/com/android/server/wm/ActivityStartInterceptor.java55
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java3
3 files changed, 24 insertions, 44 deletions
diff --git a/core/java/android/window/flags/windowing_sdk.aconfig b/core/java/android/window/flags/windowing_sdk.aconfig
index 6e45d3dc659f..de49eaef058e 100644
--- a/core/java/android/window/flags/windowing_sdk.aconfig
+++ b/core/java/android/window/flags/windowing_sdk.aconfig
@@ -124,16 +124,6 @@ flag {
flag {
namespace: "windowing_sdk"
- name: "normalize_home_intent"
- description: "To ensure home is started in correct intent"
- bug: "378505461"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
- namespace: "windowing_sdk"
name: "condense_configuration_change_for_simple_mode"
description: "Condense configuration change for simple mode"
bug: "356738240"
diff --git a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
index a318c4bf334f..5cc186c40b6c 100644
--- a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
+++ b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
@@ -73,7 +73,6 @@ import com.android.internal.app.UnlaunchableAppActivity;
import com.android.server.LocalServices;
import com.android.server.am.ActivityManagerService;
import com.android.server.wm.ActivityInterceptorCallback.ActivityInterceptResult;
-import com.android.window.flags.Flags;
/**
* A class that contains activity intercepting logic for {@link ActivityStarter#execute()}
@@ -504,43 +503,37 @@ class ActivityStartInterceptor {
}
boolean intercepted = false;
- if (Flags.normalizeHomeIntent()) {
- if (!ACTION_MAIN.equals(mIntent.getAction()) || (!mIntent.hasCategory(CATEGORY_HOME)
- && !mIntent.hasCategory(CATEGORY_SECONDARY_HOME))) {
- // not a home intent
- return false;
- }
-
- if (mComponentSpecified) {
- Slog.w(TAG, "Starting home with component specified, uid=" + mCallingUid);
- if (mService.isCallerRecents(mCallingUid)
- || ActivityTaskManagerService.checkPermission(MANAGE_ACTIVITY_TASKS,
- mCallingPid, mCallingUid) == PERMISSION_GRANTED) {
- // Allow home component specified from trusted callers.
- return false;
- }
+ if (!ACTION_MAIN.equals(mIntent.getAction()) || (!mIntent.hasCategory(CATEGORY_HOME)
+ && !mIntent.hasCategory(CATEGORY_SECONDARY_HOME))) {
+ // not a home intent
+ return false;
+ }
- final ComponentName homeComponent = mIntent.getComponent();
- final Intent homeIntent = mService.getHomeIntent();
- final ActivityInfo aInfo = mService.mRootWindowContainer.resolveHomeActivity(
- mUserId, homeIntent);
- if (!aInfo.getComponentName().equals(homeComponent)) {
- // Do nothing if the intent is not for the default home component.
- return false;
- }
+ if (mComponentSpecified) {
+ Slog.w(TAG, "Starting home with component specified, uid=" + mCallingUid);
+ if (mService.isCallerRecents(mCallingUid)
+ || ActivityTaskManagerService.checkPermission(MANAGE_ACTIVITY_TASKS,
+ mCallingPid, mCallingUid) == PERMISSION_GRANTED) {
+ // Allow home component specified from trusted callers.
+ return false;
}
- if (!ActivityRecord.isHomeIntent(mIntent) || mComponentSpecified) {
- // This is not a standard home intent, make it so if possible.
- normalizeHomeIntent();
- intercepted = true;
- }
- } else {
- if (!ActivityRecord.isHomeIntent(mIntent)) {
+ final ComponentName homeComponent = mIntent.getComponent();
+ final Intent homeIntent = mService.getHomeIntent();
+ final ActivityInfo aInfo = mService.mRootWindowContainer.resolveHomeActivity(
+ mUserId, homeIntent);
+ if (!aInfo.getComponentName().equals(homeComponent)) {
+ // Do nothing if the intent is not for the default home component.
return false;
}
}
+ if (!ActivityRecord.isHomeIntent(mIntent) || mComponentSpecified) {
+ // This is not a standard home intent, make it so if possible.
+ normalizeHomeIntent();
+ intercepted = true;
+ }
+
intercepted |= replaceToSecondaryHomeIntentIfNeeded();
if (intercepted) {
mCallingPid = mRealCallingPid;
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java
index bacf5ed9d81f..6c4f638e72f2 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java
@@ -53,7 +53,6 @@ import android.content.pm.UserPackage;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
-import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
import android.platform.test.flag.junit.SetFlagsRule;
import android.testing.DexmakerShareClassLoaderRule;
@@ -68,7 +67,6 @@ import com.android.internal.app.SuspendedAppActivity;
import com.android.internal.app.UnlaunchableAppActivity;
import com.android.server.LocalServices;
import com.android.server.am.ActivityManagerService;
-import com.android.window.flags.Flags;
import org.junit.After;
import org.junit.Before;
@@ -242,7 +240,6 @@ public class ActivityStartInterceptorTest {
}
@Test
- @EnableFlags(Flags.FLAG_NORMALIZE_HOME_INTENT)
public void testInterceptIncorrectHomeIntent() {
// Create a non-standard home intent
final Intent homeIntent = new Intent(Intent.ACTION_MAIN);