diff options
3 files changed, 0 insertions, 119 deletions
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 f5eee5ac160d..000000000000 --- 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 96f00414c494..386c4372ca65 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 @@ public class PackageManagerService implements PackageSender, TestUtilityService private final DexOptHelper mDexOptHelper; private final SuspendPackageHelper mSuspendPackageHelper; private final DistractingPackageHelper mDistractingPackageHelper; - private final IntentResolverInterceptor mIntentResolverInterceptor; private final StorageEventHelper mStorageEventHelper; /** @@ -1688,7 +1687,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService mSharedLibraries.setDeletePackageHelper(mDeletePackageHelper); - mIntentResolverInterceptor = null; mStorageEventHelper = testParams.storageEventHelper; registerObservers(false); @@ -2248,8 +2246,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService mServiceStartWithDelay = SystemClock.uptimeMillis() + (60 * 1000L); - mIntentResolverInterceptor = new IntentResolverInterceptor(mContext); - Slog.i(TAG, "Fix for b/169414761 is applied"); } @@ -4139,11 +4135,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService // 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 34483957ca12..48e6f972fc8e 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 @@ public abstract class ActivityInterceptorCallback { @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 abstract class ActivityInterceptorCallback { 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. */ |