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

Commit 35f6fa79 authored by Daulet Zhanguzin's avatar Daulet Zhanguzin Committed by Android (Google) Code Review
Browse files

Merge "Replace com.android.internal.util.Preconditions.checkNotNull with...

Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull"
parents b644ae20 82adfcbb
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.server.wm.ActivityTaskManagerInternal;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub {
    private static final String TAG = "CrossProfileAppsService";
@@ -67,7 +68,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub {

    @Override
    public List<UserHandle> getTargetUserProfiles(String callingPackage) {
        Preconditions.checkNotNull(callingPackage);
        Objects.requireNonNull(callingPackage);

        verifyCallingPackage(callingPackage);

@@ -87,8 +88,8 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub {
            ComponentName component,
            @UserIdInt int userId,
            boolean launchMainActivity) throws RemoteException {
        Preconditions.checkNotNull(callingPackage);
        Preconditions.checkNotNull(component);
        Objects.requireNonNull(callingPackage);
        Objects.requireNonNull(component);

        verifyCallingPackage(callingPackage);

+6 −5
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.security.PublicKey;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

/*
@@ -219,10 +220,10 @@ public class KeySetManagerService {
    }

    public void addScannedPackageLPw(AndroidPackage pkg) {
        Preconditions.checkNotNull(pkg, "Attempted to add null pkg to ksms.");
        Preconditions.checkNotNull(pkg.getPackageName(), "Attempted to add null pkg to ksms.");
        Objects.requireNonNull(pkg, "Attempted to add null pkg to ksms.");
        Objects.requireNonNull(pkg.getPackageName(), "Attempted to add null pkg to ksms.");
        PackageSetting ps = mPackages.get(pkg.getPackageName());
        Preconditions.checkNotNull(ps, "pkg: " + pkg.getPackageName()
        Objects.requireNonNull(ps, "pkg: " + pkg.getPackageName()
                    + "does not have a corresponding entry in mPackages.");
        addSigningKeySetToPackageLPw(ps, pkg.getSigningDetails().publicKeys);
        if (pkg.getKeySetMapping() != null) {
@@ -504,7 +505,7 @@ public class KeySetManagerService {
     * Adds the given PublicKey to the system, deduping as it goes.
     */
    private long addPublicKeyLPw(PublicKey key) {
        Preconditions.checkNotNull(key, "Cannot add null public key!");
        Objects.requireNonNull(key, "Cannot add null public key!");
        long id = getIdForPublicKeyLPr(key);
        if (id != PUBLIC_KEY_NOT_FOUND) {

@@ -574,7 +575,7 @@ public class KeySetManagerService {

        /* remove refs from common keysets and public keys */
        PackageSetting pkg = mPackages.get(packageName);
        Preconditions.checkNotNull(pkg, "pkg name: " + packageName
        Objects.requireNonNull(pkg, "pkg name: " + packageName
                + "does not have a corresponding entry in mPackages.");
        long signingKeySetId = pkg.keySetData.getProperSigningKeySet();
        decrementKeySetLPw(signingKeySetId);
+7 −6
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;

/**
 * Service that manages requests and callbacks for launchers that support
@@ -136,15 +137,15 @@ public class LauncherAppsService extends SystemService {
        public LauncherAppsImpl(Context context) {
            mContext = context;
            mUm = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
            mUserManagerInternal = Preconditions.checkNotNull(
            mUserManagerInternal = Objects.requireNonNull(
                    LocalServices.getService(UserManagerInternal.class));
            mUsageStatsManagerInternal = Preconditions.checkNotNull(
            mUsageStatsManagerInternal = Objects.requireNonNull(
                    LocalServices.getService(UsageStatsManagerInternal.class));
            mActivityManagerInternal = Preconditions.checkNotNull(
            mActivityManagerInternal = Objects.requireNonNull(
                    LocalServices.getService(ActivityManagerInternal.class));
            mActivityTaskManagerInternal = Preconditions.checkNotNull(
            mActivityTaskManagerInternal = Objects.requireNonNull(
                    LocalServices.getService(ActivityTaskManagerInternal.class));
            mShortcutServiceInternal = Preconditions.checkNotNull(
            mShortcutServiceInternal = Objects.requireNonNull(
                    LocalServices.getService(ShortcutServiceInternal.class));
            mShortcutServiceInternal.addListener(mPackageMonitor);
            mCallbackHandler = BackgroundThread.getHandler();
@@ -558,7 +559,7 @@ public class LauncherAppsService extends SystemService {
            if (!canAccessProfile(user.getIdentifier(), "Cannot check package")) {
                return null;
            }
            Preconditions.checkNotNull(component);
            Objects.requireNonNull(component);

            // All right, create the sender.
            Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT).setComponent(component);
+8 −7
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

@@ -511,7 +512,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        this.userId = userId;
        mOriginalInstallerUid = installerUid;
        mInstallerUid = installerUid;
        mInstallSource = Preconditions.checkNotNull(installSource);
        mInstallSource = Objects.requireNonNull(installSource);
        this.params = params;
        this.createdMillis = createdMillis;
        this.updatedMillis = createdMillis;
@@ -1143,7 +1144,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
     * permissions.
     */
    private boolean markAsCommitted(@NonNull IntentSender statusReceiver) {
        Preconditions.checkNotNull(statusReceiver);
        Objects.requireNonNull(statusReceiver);

        List<PackageInstallerSession> childSessions = getChildSessions();

@@ -1408,8 +1409,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {

    @Override
    public void transfer(String packageName, IntentSender statusReceiver) {
        Preconditions.checkNotNull(statusReceiver);
        Preconditions.checkNotNull(packageName);
        Objects.requireNonNull(statusReceiver);
        Objects.requireNonNull(packageName);

        try {
            assertCanBeTransferredAndReturnNewOwner(packageName);
@@ -1607,9 +1608,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
            localObserver = null;
        } else {
            if (!params.isMultiPackage) {
                Preconditions.checkNotNull(mPackageName);
                Preconditions.checkNotNull(mSigningDetails);
                Preconditions.checkNotNull(mResolvedBaseFile);
                Objects.requireNonNull(mPackageName);
                Objects.requireNonNull(mSigningDetails);
                Objects.requireNonNull(mResolvedBaseFile);

                if (needToAskForPermissionsLocked()) {
                    // User needs to confirm installation;
+2 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.internal.util.Preconditions;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
@@ -172,7 +173,7 @@ public abstract class PackageSettingBase extends SettingBase {
    }

    public void setInstallSource(InstallSource installSource) {
        this.installSource = Preconditions.checkNotNull(installSource);
        this.installSource = Objects.requireNonNull(installSource);
    }

    void removeInstallerPackage(String packageName) {
Loading