diff options
10 files changed, 13 insertions, 37 deletions
diff --git a/services/core/java/com/android/server/pm/BackgroundInstallControlService.java b/services/core/java/com/android/server/pm/BackgroundInstallControlService.java index 7f0aadce3143..c110fb67b54f 100644 --- a/services/core/java/com/android/server/pm/BackgroundInstallControlService.java +++ b/services/core/java/com/android/server/pm/BackgroundInstallControlService.java @@ -75,11 +75,9 @@ public class BackgroundInstallControlService extends SystemService { private static final int MSG_PACKAGE_ADDED = 1; private static final int MSG_PACKAGE_REMOVED = 2; - private final Context mContext; private final BinderService mBinderService; private final PackageManager mPackageManager; private final PackageManagerInternal mPackageManagerInternal; - private final UsageStatsManagerInternal mUsageStatsManagerInternal; private final PermissionManagerServiceInternal mPermissionManager; private final Handler mHandler; private final File mDiskFile; @@ -99,14 +97,14 @@ public class BackgroundInstallControlService extends SystemService { @VisibleForTesting BackgroundInstallControlService(@NonNull Injector injector) { super(injector.getContext()); - mContext = injector.getContext(); mPackageManager = injector.getPackageManager(); mPackageManagerInternal = injector.getPackageManagerInternal(); mPermissionManager = injector.getPermissionManager(); mHandler = new EventHandler(injector.getLooper(), this); mDiskFile = injector.getDiskFile(); - mUsageStatsManagerInternal = injector.getUsageStatsManagerInternal(); - mUsageStatsManagerInternal.registerListener( + UsageStatsManagerInternal usageStatsManagerInternal = + injector.getUsageStatsManagerInternal(); + usageStatsManagerInternal.registerListener( (userId, event) -> mHandler.obtainMessage(MSG_USAGE_EVENT_RECEIVED, userId, diff --git a/services/core/java/com/android/server/pm/DataLoaderManagerService.java b/services/core/java/com/android/server/pm/DataLoaderManagerService.java index 888e1c26206c..c25cea65376b 100644 --- a/services/core/java/com/android/server/pm/DataLoaderManagerService.java +++ b/services/core/java/com/android/server/pm/DataLoaderManagerService.java @@ -47,7 +47,6 @@ import java.util.List; public class DataLoaderManagerService extends SystemService { private static final String TAG = "DataLoaderManager"; private final Context mContext; - private final HandlerThread mThread; private final Handler mHandler; private final DataLoaderManagerBinderService mBinderService; private final SparseArray<DataLoaderServiceConnection> mServiceConnections = @@ -57,10 +56,10 @@ public class DataLoaderManagerService extends SystemService { super(context); mContext = context; - mThread = new HandlerThread(TAG); - mThread.start(); + HandlerThread thread = new HandlerThread(TAG); + thread.start(); - mHandler = new Handler(mThread.getLooper()); + mHandler = new Handler(thread.getLooper()); mBinderService = new DataLoaderManagerBinderService(); } diff --git a/services/core/java/com/android/server/pm/IPackageManagerBase.java b/services/core/java/com/android/server/pm/IPackageManagerBase.java index e3bbd2d8d17e..f987d4ae8999 100644 --- a/services/core/java/com/android/server/pm/IPackageManagerBase.java +++ b/services/core/java/com/android/server/pm/IPackageManagerBase.java @@ -107,9 +107,6 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub { @Nullable private final ComponentName mInstantAppResolverSettingsComponent; - @NonNull - private final String mRequiredSupplementalProcessPackage; - @Nullable private final String mServicesExtensionPackageName; @@ -125,7 +122,6 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub { @NonNull PackageInstallerService installerService, @NonNull PackageProperty packageProperty, @NonNull ComponentName resolveComponentName, @Nullable ComponentName instantAppResolverSettingsComponent, - @NonNull String requiredSupplementalProcessPackage, @Nullable String servicesExtensionPackageName, @Nullable String sharedSystemSharedLibraryPackageName) { mService = service; @@ -140,7 +136,6 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub { mPackageProperty = packageProperty; mResolveComponentName = resolveComponentName; mInstantAppResolverSettingsComponent = instantAppResolverSettingsComponent; - mRequiredSupplementalProcessPackage = requiredSupplementalProcessPackage; mServicesExtensionPackageName = servicesExtensionPackageName; mSharedSystemSharedLibraryPackageName = sharedSystemSharedLibraryPackageName; } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 5225529ef001..c5b5a761497d 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -4659,8 +4659,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService mPreferredActivityHelper, mResolveIntentHelper, mDomainVerificationManager, mDomainVerificationConnection, mInstallerService, mPackageProperty, mResolveComponentName, mInstantAppResolverSettingsComponent, - mRequiredSdkSandboxPackage, mServicesExtensionPackageName, - mSharedSystemSharedLibraryPackageName); + mServicesExtensionPackageName, mSharedSystemSharedLibraryPackageName); } @Override diff --git a/services/core/java/com/android/server/pm/ProtectedPackages.java b/services/core/java/com/android/server/pm/ProtectedPackages.java index 98533725371f..524252c1469f 100644 --- a/services/core/java/com/android/server/pm/ProtectedPackages.java +++ b/services/core/java/com/android/server/pm/ProtectedPackages.java @@ -57,11 +57,8 @@ public class ProtectedPackages { @GuardedBy("this") private final SparseArray<Set<String>> mOwnerProtectedPackages = new SparseArray<>(); - private final Context mContext; - public ProtectedPackages(Context context) { - mContext = context; - mDeviceProvisioningPackage = mContext.getResources().getString( + mDeviceProvisioningPackage = context.getResources().getString( R.string.config_deviceProvisioningPackage); } diff --git a/services/core/java/com/android/server/pm/RemovePackageHelper.java b/services/core/java/com/android/server/pm/RemovePackageHelper.java index 285445361a29..ce96e835c3f5 100644 --- a/services/core/java/com/android/server/pm/RemovePackageHelper.java +++ b/services/core/java/com/android/server/pm/RemovePackageHelper.java @@ -67,7 +67,6 @@ final class RemovePackageHelper { private final PackageManagerService mPm; private final IncrementalManager mIncrementalManager; private final Installer mInstaller; - private final UserManagerInternal mUserManagerInternal; private final PermissionManagerServiceInternal mPermissionManager; private final SharedLibrariesImpl mSharedLibraries; private final AppDataHelper mAppDataHelper; @@ -79,7 +78,6 @@ final class RemovePackageHelper { mPm = pm; mIncrementalManager = mPm.mInjector.getIncrementalManager(); mInstaller = mPm.mInjector.getInstaller(); - mUserManagerInternal = mPm.mInjector.getUserManagerInternal(); mPermissionManager = mPm.mInjector.getPermissionManagerServiceInternal(); mSharedLibraries = mPm.mInjector.getSharedLibrariesImpl(); mAppDataHelper = appDataHelper; diff --git a/services/core/java/com/android/server/pm/ShortcutNonPersistentUser.java b/services/core/java/com/android/server/pm/ShortcutNonPersistentUser.java index 7f6f684e0b68..aa52522cfe46 100644 --- a/services/core/java/com/android/server/pm/ShortcutNonPersistentUser.java +++ b/services/core/java/com/android/server/pm/ShortcutNonPersistentUser.java @@ -31,7 +31,6 @@ import java.io.PrintWriter; * The access to it must be guarded with the shortcut manager lock. */ public class ShortcutNonPersistentUser { - private final ShortcutService mService; private final int mUserId; @@ -49,8 +48,7 @@ public class ShortcutNonPersistentUser { */ private final ArraySet<String> mHostPackageSet = new ArraySet<>(); - public ShortcutNonPersistentUser(ShortcutService service, int userId) { - mService = service; + public ShortcutNonPersistentUser(int userId) { mUserId = userId; } diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java index 3adeb4b5925f..acc26cd49117 100644 --- a/services/core/java/com/android/server/pm/ShortcutService.java +++ b/services/core/java/com/android/server/pm/ShortcutService.java @@ -1371,7 +1371,7 @@ public class ShortcutService extends IShortcutService.Stub { ShortcutNonPersistentUser getNonPersistentUserLocked(@UserIdInt int userId) { ShortcutNonPersistentUser ret = mShortcutNonPersistentUsers.get(userId); if (ret == null) { - ret = new ShortcutNonPersistentUser(this, userId); + ret = new ShortcutNonPersistentUser(userId); mShortcutNonPersistentUsers.put(userId, ret); } return ret; diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java index 10e6edc2941f..b2483d139a0c 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java @@ -76,7 +76,6 @@ import com.android.internal.util.Preconditions; import com.android.internal.util.function.QuadFunction; import com.android.internal.util.function.TriFunction; import com.android.server.LocalServices; -import com.android.server.pm.UserManagerInternal; import com.android.server.pm.UserManagerService; import com.android.server.pm.permission.PermissionManagerServiceInternal.HotwordDetectionServiceProvider; import com.android.server.pm.pkg.AndroidPackage; @@ -113,9 +112,6 @@ public class PermissionManagerService extends IPermissionManager.Stub { /** Internal connection to the package manager */ private final PackageManagerInternal mPackageManagerInt; - /** Internal connection to the user manager */ - private final UserManagerInternal mUserManagerInt; - /** Map of OneTimePermissionUserManagers keyed by userId */ @GuardedBy("mLock") @NonNull @@ -147,7 +143,6 @@ public class PermissionManagerService extends IPermissionManager.Stub { mContext = context; mPackageManagerInt = LocalServices.getService(PackageManagerInternal.class); - mUserManagerInt = LocalServices.getService(UserManagerInternal.class); mAppOpsManager = context.getSystemService(AppOpsManager.class); mAttributionSourceRegistry = new AttributionSourceRegistry(context); @@ -1080,12 +1075,10 @@ public class PermissionManagerService extends IPermissionManager.Stub { private static final AtomicInteger sAttributionChainIds = new AtomicInteger(0); private final @NonNull Context mContext; - private final @NonNull AppOpsManager mAppOpsManager; private final @NonNull PermissionManagerServiceInternal mPermissionManagerServiceInternal; PermissionCheckerService(@NonNull Context context) { mContext = context; - mAppOpsManager = mContext.getSystemService(AppOpsManager.class); mPermissionManagerServiceInternal = LocalServices.getService(PermissionManagerServiceInternal.class); } diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java index 3afba39ad4af..6a5736269e51 100644 --- a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java +++ b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java @@ -279,7 +279,6 @@ public class PermissionManagerServiceImpl implements PermissionManagerServiceInt @NonNull private final int[] mGlobalGids; - private final HandlerThread mHandlerThread; private final Handler mHandler; private final Context mContext; private final MetricsLogger mMetricsLogger = new MetricsLogger(); @@ -432,10 +431,10 @@ public class PermissionManagerServiceImpl implements PermissionManagerServiceInt } } - mHandlerThread = new ServiceThread(TAG, + HandlerThread handlerThread = new ServiceThread(TAG, Process.THREAD_PRIORITY_BACKGROUND, true /*allowIo*/); - mHandlerThread.start(); - mHandler = new Handler(mHandlerThread.getLooper()); + handlerThread.start(); + mHandler = new Handler(handlerThread.getLooper()); Watchdog.getInstance().addThread(mHandler); SystemConfig systemConfig = SystemConfig.getInstance(); |