Remove IntentResolverInterceptor
Not toggling configurations in release.
Test: Invocation of ChooserActivity
Bug: 222706900
Change-Id: I43f26f321b81c2ab660c46d22d323709981d982c
diff --git a/services/core/java/com/android/server/pm/IntentResolverInterceptor.java b/services/core/java/com/android/server/pm/IntentResolverInterceptor.java
deleted file mode 100644
index f5eee5a..0000000
--- a/services/core/java/com/android/server/pm/IntentResolverInterceptor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2022 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.server.pm;
-
-import static com.android.server.wm.ActivityInterceptorCallback.INTENT_RESOLVER_ORDERED_ID;
-
-import android.Manifest;
-import android.annotation.Nullable;
-import android.annotation.RequiresPermission;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.res.Resources;
-import android.provider.DeviceConfig;
-import android.util.Slog;
-
-import com.android.internal.R;
-import com.android.internal.app.ChooserActivity;
-import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
-import com.android.server.LocalServices;
-import com.android.server.wm.ActivityInterceptorCallback;
-import com.android.server.wm.ActivityInterceptorCallback.ActivityInterceptorInfo;
-import com.android.server.wm.ActivityTaskManagerInternal;
-
-/**
- * Redirects Activity starts for the system bundled {@link ChooserActivity} to an external
- * Sharesheet implementation by modifying the target component when appropriate.
- * <p>
- * Note: config_chooserActivity (Used also by ActivityTaskSupervisor) is already updated to point
- * to the new instance. This value is read and used for the new target component.
- */
-public final class IntentResolverInterceptor {
- private static final String TAG = "IntentResolverIntercept";
- private final Context mContext;
- private final ComponentName mFrameworkChooserComponent;
- private final ComponentName mUnbundledChooserComponent;
- private boolean mUseUnbundledSharesheet;
-
- private final ActivityInterceptorCallback mActivityInterceptorCallback =
- new ActivityInterceptorCallback() {
- @Nullable
- @Override
- public ActivityInterceptResult intercept(ActivityInterceptorInfo info) {
- if (mUseUnbundledSharesheet && isSystemChooserActivity(info)) {
- Slog.d(TAG, "Redirecting to UNBUNDLED Sharesheet");
- info.intent.setComponent(mUnbundledChooserComponent);
- return new ActivityInterceptResult(info.intent, info.checkedOptions);
- }
- return null;
- }
- };
-
- public IntentResolverInterceptor(Context context) {
- mContext = context;
- mFrameworkChooserComponent = new ComponentName(mContext, ChooserActivity.class);
- mUnbundledChooserComponent = ComponentName.unflattenFromString(
- Resources.getSystem().getString(R.string.config_chooserActivity));
- }
-
- /**
- * Start listening for intents and USE_UNBUNDLED_SHARESHEET property changes.
- */
- @RequiresPermission(Manifest.permission.READ_DEVICE_CONFIG)
- public void registerListeners() {
- LocalServices.getService(ActivityTaskManagerInternal.class)
- .registerActivityStartInterceptor(INTENT_RESOLVER_ORDERED_ID,
- mActivityInterceptorCallback);
-
- DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
- mContext.getMainExecutor(), properties -> updateUseUnbundledSharesheet());
- updateUseUnbundledSharesheet();
- }
-
- @RequiresPermission(Manifest.permission.READ_DEVICE_CONFIG)
- private void updateUseUnbundledSharesheet() {
- mUseUnbundledSharesheet = DeviceConfig.getBoolean(
- DeviceConfig.NAMESPACE_SYSTEMUI,
- SystemUiDeviceConfigFlags.USE_UNBUNDLED_SHARESHEET,
- false);
- if (mUseUnbundledSharesheet) {
- Slog.d(TAG, "using UNBUNDLED Sharesheet");
- } else {
- Slog.d(TAG, "using FRAMEWORK Sharesheet");
- }
- }
-
- private boolean isSystemChooserActivity(ActivityInterceptorInfo info) {
- return mFrameworkChooserComponent.getPackageName().equals(info.aInfo.packageName)
- && mFrameworkChooserComponent.getClassName().equals(info.aInfo.name);
- }
-}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 2cef35f..72c4be8 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -939,7 +939,6 @@
private final DexOptHelper mDexOptHelper;
private final SuspendPackageHelper mSuspendPackageHelper;
private final DistractingPackageHelper mDistractingPackageHelper;
- private final IntentResolverInterceptor mIntentResolverInterceptor;
private final StorageEventHelper mStorageEventHelper;
/**
@@ -1691,7 +1690,6 @@
mSharedLibraries.setDeletePackageHelper(mDeletePackageHelper);
- mIntentResolverInterceptor = null;
mStorageEventHelper = testParams.storageEventHelper;
registerObservers(false);
@@ -2252,8 +2250,6 @@
mServiceStartWithDelay = SystemClock.uptimeMillis() + (60 * 1000L);
- mIntentResolverInterceptor = new IntentResolverInterceptor(mContext);
-
Slog.i(TAG, "Fix for b/169414761 is applied");
}
@@ -4143,11 +4139,6 @@
// Prune unused static shared libraries which have been cached a period of time
schedulePruneUnusedStaticSharedLibraries(false /* delay */);
-
- // TODO(b/222706900): Remove this intent interceptor before T launch
- if (mIntentResolverInterceptor != null) {
- mIntentResolverInterceptor.registerListeners();
- }
}
//TODO: b/111402650
diff --git a/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java b/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java
index 3448395..48e6f97 100644
--- a/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java
+++ b/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java
@@ -59,7 +59,6 @@
@IntDef(suffix = { "_ORDERED_ID" }, value = {
FIRST_ORDERED_ID,
PERMISSION_POLICY_ORDERED_ID,
- INTENT_RESOLVER_ORDERED_ID,
VIRTUAL_DEVICE_SERVICE_ORDERED_ID,
DREAM_MANAGER_ORDERED_ID,
LAST_ORDERED_ID // Update this when adding new ids
@@ -78,11 +77,6 @@
public static final int PERMISSION_POLICY_ORDERED_ID = 1;
/**
- * The identifier for {@link com.android.server.pm.IntentResolverInterceptor}.
- */
- public static final int INTENT_RESOLVER_ORDERED_ID = 2;
-
- /**
* The identifier for {@link com.android.server.companion.virtual.VirtualDeviceManagerService}
* interceptor.
*/