Java Code Examples for com.android.internal.util.ArrayUtils#isEmpty()

The following examples show how to use com.android.internal.util.ArrayUtils#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstantAppRegistry.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void propagateInstantAppPermissionsIfNeeded(@NonNull PackageParser.Package pkg,
        @UserIdInt int userId) {
    InstantAppInfo appInfo = peekOrParseUninstalledInstantAppInfo(
            pkg.packageName, userId);
    if (appInfo == null) {
        return;
    }
    if (ArrayUtils.isEmpty(appInfo.getGrantedPermissions())) {
        return;
    }
    final long identity = Binder.clearCallingIdentity();
    try {
        for (String grantedPermission : appInfo.getGrantedPermissions()) {
            final boolean propagatePermission =
                    mService.mSettings.canPropagatePermissionToInstantApp(grantedPermission);
            if (propagatePermission && pkg.requestedPermissions.contains(grantedPermission)) {
                mService.grantRuntimePermission(pkg.packageName, grantedPermission, userId);
            }
        }
    } finally {
        Binder.restoreCallingIdentity(identity);
    }
}
 
Example 2
Source File: LockSettingsStorage.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private CredentialHash readPatternHashIfExists(int userId) {
    byte[] stored = readFile(getLockPatternFilename(userId));
    if (!ArrayUtils.isEmpty(stored)) {
        return new CredentialHash(stored, LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
                CredentialHash.VERSION_GATEKEEPER);
    }

    stored = readFile(getBaseZeroLockPatternFilename(userId));
    if (!ArrayUtils.isEmpty(stored)) {
        return CredentialHash.createBaseZeroPattern(stored);
    }

    stored = readFile(getLegacyLockPatternFilename(userId));
    if (!ArrayUtils.isEmpty(stored)) {
        return new CredentialHash(stored, LockPatternUtils.CREDENTIAL_TYPE_PATTERN,
                CredentialHash.VERSION_LEGACY);
    }
    return null;
}
 
Example 3
Source File: PowerManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void onBootPhase(int phase) {
    synchronized (mLock) {
        if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
            incrementBootCount();

        } else if (phase == PHASE_BOOT_COMPLETED) {
            final long now = SystemClock.uptimeMillis();
            mBootCompleted = true;
            mDirty |= DIRTY_BOOT_COMPLETED;

            mBatterySaverStateMachine.onBootCompleted();
            userActivityNoUpdateLocked(
                    now, PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
            updatePowerStateLocked();

            if (!ArrayUtils.isEmpty(mBootCompletedRunnables)) {
                Slog.d(TAG, "Posting " + mBootCompletedRunnables.length + " delayed runnables");
                for (Runnable r : mBootCompletedRunnables) {
                    BackgroundThread.getHandler().post(r);
                }
            }
            mBootCompletedRunnables = null;
        }
    }
}
 
Example 4
Source File: StorageManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void unlockUserKey(int userId, int serialNumber, byte[] token, byte[] secret) {
    enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);

    if (StorageManager.isFileEncryptedNativeOrEmulated()) {
        // When a user has secure lock screen, require secret to actually unlock.
        // This check is mostly in place for emulation mode.
        if (mLockPatternUtils.isSecure(userId) && ArrayUtils.isEmpty(secret)) {
            throw new IllegalStateException("Secret required to unlock secure user " + userId);
        }

        try {
            mVold.unlockUserKey(userId, serialNumber, encodeBytes(token),
                    encodeBytes(secret));
        } catch (Exception e) {
            Slog.wtf(TAG, e);
            return;
        }
    }

    synchronized (mLock) {
        mLocalUnlockedUsers = ArrayUtils.appendInt(mLocalUnlockedUsers, userId);
    }
}
 
Example 5
Source File: PackageManagerShellCommand.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Displays the package file for a package.
 * @param pckg
 */
private int displayPackageFilePath(String pckg, int userId) throws RemoteException {
    PackageInfo info = mInterface.getPackageInfo(pckg, 0, userId);
    if (info != null && info.applicationInfo != null) {
        final PrintWriter pw = getOutPrintWriter();
        pw.print("package:");
        pw.println(info.applicationInfo.sourceDir);
        if (!ArrayUtils.isEmpty(info.applicationInfo.splitSourceDirs)) {
            for (String splitSourceDir : info.applicationInfo.splitSourceDirs) {
                pw.print("package:");
                pw.println(splitSourceDir);
            }
        }
        return 0;
    }
    return 1;
}
 
Example 6
Source File: LoadedApk.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private void setApplicationInfo(ApplicationInfo aInfo) {
    final int myUid = Process.myUid();
    aInfo = adjustNativeLibraryPaths(aInfo);
    mApplicationInfo = aInfo;
    mAppDir = aInfo.sourceDir;
    mResDir = aInfo.uid == myUid ? aInfo.sourceDir : aInfo.publicSourceDir;
    mOverlayDirs = aInfo.resourceDirs;
    mDataDir = aInfo.dataDir;
    mLibDir = aInfo.nativeLibraryDir;
    mDataDirFile = FileUtils.newFileOrNull(aInfo.dataDir);
    mDeviceProtectedDataDirFile = FileUtils.newFileOrNull(aInfo.deviceProtectedDataDir);
    mCredentialProtectedDataDirFile = FileUtils.newFileOrNull(aInfo.credentialProtectedDataDir);

    mSplitNames = aInfo.splitNames;
    mSplitAppDirs = aInfo.splitSourceDirs;
    mSplitResDirs = aInfo.uid == myUid ? aInfo.splitSourceDirs : aInfo.splitPublicSourceDirs;
    mSplitClassLoaderNames = aInfo.splitClassLoaderNames;

    if (aInfo.requestsIsolatedSplitLoading() && !ArrayUtils.isEmpty(mSplitNames)) {
        mSplitLoader = new SplitDependencyLoaderImpl(aInfo.splitDependencies);
    }
}
 
Example 7
Source File: NetworkTemplate.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Check if mobile network with matching IMSI.
 */
private boolean matchesMobile(NetworkIdentity ident) {
    if (ident.mType == TYPE_WIMAX) {
        // TODO: consider matching against WiMAX subscriber identity
        return true;
    } else {
        return (sForceAllNetworkTypes || (ident.mType == TYPE_MOBILE && ident.mMetered))
                && !ArrayUtils.isEmpty(mMatchSubscriberIds)
                && ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId);
    }
}
 
Example 8
Source File: DexManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Generates log if the APKs in the given package have uncompressed dex file and so
 * files that can be direclty mapped.
 */
private static void logIfPackageHasUncompressedCode(PackageParser.Package pkg) {
    logIfApkHasUncompressedCode(pkg.baseCodePath);
    if (!ArrayUtils.isEmpty(pkg.splitCodePaths)) {
        for (int i = 0; i < pkg.splitCodePaths.length; i++) {
            logIfApkHasUncompressedCode(pkg.splitCodePaths[i]);
        }
    }
}
 
Example 9
Source File: AppOpsService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private boolean isDefault(boolean[] array) {
    if (ArrayUtils.isEmpty(array)) {
        return true;
    }
    for (boolean value : array) {
        if (value) {
            return false;
        }
    }
    return true;
}
 
Example 10
Source File: PackageManager.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an {@link android.content.Intent} suitable for passing to
 * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
 * which prompts the user to grant permissions to this application.
 *
 * @throws NullPointerException if {@code permissions} is {@code null} or empty.
 *
 * @hide
 */
public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) {
    if (ArrayUtils.isEmpty(permissions)) {
       throw new NullPointerException("permission cannot be null or empty");
    }
    Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS);
    intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions);
    intent.setPackage(getPermissionControllerPackageName());
    return intent;
}
 
Example 11
Source File: NetworkMonitor.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private CaptivePortalProbeSpec nextFallbackSpec() {
    if (ArrayUtils.isEmpty(mCaptivePortalFallbackSpecs)) {
        return null;
    }
    // Randomly change spec without memory. Also randomize the first attempt.
    final int idx = Math.abs(new Random().nextInt()) % mCaptivePortalFallbackSpecs.length;
    return mCaptivePortalFallbackSpecs[idx];
}
 
Example 12
Source File: LockSettingsStorage.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private CredentialHash readPasswordHashIfExists(int userId) {
    byte[] stored = readFile(getLockPasswordFilename(userId));
    if (!ArrayUtils.isEmpty(stored)) {
        return new CredentialHash(stored, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
                CredentialHash.VERSION_GATEKEEPER);
    }

    stored = readFile(getLegacyLockPasswordFilename(userId));
    if (!ArrayUtils.isEmpty(stored)) {
        return new CredentialHash(stored, LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
                CredentialHash.VERSION_LEGACY);
    }
    return null;
}
 
Example 13
Source File: PermissionsState.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private int revokePermission(BasePermission permission, int userId) {
    final String permName = permission.getName();
    if (!hasPermission(permName, userId)) {
        return PERMISSION_OPERATION_FAILURE;
    }

    final boolean hasGids = !ArrayUtils.isEmpty(permission.computeGids(userId));
    final int[] oldGids = hasGids ? computeGids(userId) : NO_GIDS;

    PermissionData permissionData = mPermissions.get(permName);

    if (!permissionData.revoke(userId)) {
        return PERMISSION_OPERATION_FAILURE;
    }

    if (permissionData.isDefault()) {
        ensureNoPermissionData(permName);
    }

    if (hasGids) {
        final int[] newGids = computeGids(userId);
        if (oldGids.length != newGids.length) {
            return PERMISSION_OPERATION_SUCCESS_GIDS_CHANGED;
        }
    }

    return PERMISSION_OPERATION_SUCCESS;
}
 
Example 14
Source File: BackupUtils.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public static boolean signaturesMatch(ArrayList<byte[]> storedSigHashes, PackageInfo target,
        PackageManagerInternal pmi) {
    if (target == null || target.packageName == null) {
        return false;
    }
    // If the target resides on the system partition, we allow it to restore
    // data from the like-named package in a restore set even if the signatures
    // do not match.  (Unlike general applications, those flashed to the system
    // partition will be signed with the device's platform certificate, so on
    // different phones the same system app will have different signatures.)
    if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        if (DEBUG) Slog.v(TAG, "System app " + target.packageName + " - skipping sig check");
        return true;
    }

    // Don't allow unsigned apps on either end
    if (ArrayUtils.isEmpty(storedSigHashes)) {
        return false;
    }

    SigningInfo signingInfo = target.signingInfo;
    if (signingInfo == null) {
        Slog.w(TAG, "signingInfo is empty, app was either unsigned or the flag" +
                " PackageManager#GET_SIGNING_CERTIFICATES was not specified");
        return false;
    }

    if (DEBUG) {
        Slog.v(TAG, "signaturesMatch(): stored=" + storedSigHashes
                + " device=" + signingInfo.getApkContentsSigners());
    }

    final int nStored = storedSigHashes.size();
    if (nStored == 1) {
        // if the app is only signed with one sig, it's possible it has rotated its key
        // the checks with signing history are delegated to PackageManager
        // TODO(b/73988180): address the case that app has declared restoreAnyVersion and is
        // restoring from higher version to lower after having rotated the key (i.e. higher
        // version has different sig than lower version that we want to restore to)
        return pmi.isDataRestoreSafe(storedSigHashes.get(0), target.packageName);
    } else {
        // the app couldn't have rotated keys, since it was signed with multiple sigs - do
        // a check to see if we find a match for all stored sigs
        // since app hasn't rotated key, we only need to check with current signers
        ArrayList<byte[]> deviceHashes =
                hashSignatureArray(signingInfo.getApkContentsSigners());
        int nDevice = deviceHashes.size();
        // ensure that each stored sig matches an on-device sig
        for (int i = 0; i < nStored; i++) {
            boolean match = false;
            for (int j = 0; j < nDevice; j++) {
                if (Arrays.equals(storedSigHashes.get(i), deviceHashes.get(j))) {
                    match = true;
                    break;
                }
            }
            if (!match) {
                return false;
            }
        }
        // we have found a match for all stored sigs
        return true;
    }
}
 
Example 15
Source File: ApplicationInfo.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
/** @hide */
public void dump(Printer pw, String prefix, int dumpFlags) {
    super.dumpFront(pw, prefix);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && className != null) {
        pw.println(prefix + "className=" + className);
    }
    if (permission != null) {
        pw.println(prefix + "permission=" + permission);
    }
    pw.println(prefix + "processName=" + processName);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "taskAffinity=" + taskAffinity);
    }
    pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
            + " privateFlags=0x" + Integer.toHexString(privateFlags)
            + " theme=0x" + Integer.toHexString(theme));
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
                + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
                + " largestWidthLimitDp=" + largestWidthLimitDp);
    }
    pw.println(prefix + "sourceDir=" + sourceDir);
    if (!Objects.equals(sourceDir, publicSourceDir)) {
        pw.println(prefix + "publicSourceDir=" + publicSourceDir);
    }
    if (!ArrayUtils.isEmpty(splitSourceDirs)) {
        pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
    }
    if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
            && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
        pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
    }
    if (resourceDirs != null) {
        pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs));
    }
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && seInfo != null) {
        pw.println(prefix + "seinfo=" + seInfo);
        pw.println(prefix + "seinfoUser=" + seInfoUser);
    }
    pw.println(prefix + "dataDir=" + dataDir);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir);
        pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir);
        if (sharedLibraryFiles != null) {
            pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
        }
    }
    if (classLoaderName != null) {
        pw.println(prefix + "classLoaderName=" + classLoaderName);
    }
    if (!ArrayUtils.isEmpty(splitClassLoaderNames)) {
        pw.println(prefix + "splitClassLoaderNames=" + Arrays.toString(splitClassLoaderNames));
    }

    pw.println(prefix + "enabled=" + enabled
            + " minSdkVersion=" + minSdkVersion
            + " targetSdkVersion=" + targetSdkVersion
            + " versionCode=" + longVersionCode
            + " targetSandboxVersion=" + targetSandboxVersion);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        if (manageSpaceActivityName != null) {
            pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName);
        }
        if (descriptionRes != 0) {
            pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes));
        }
        if (uiOptions != 0) {
            pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
        }
        pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
        if (fullBackupContent > 0) {
            pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent);
        } else {
            pw.println(prefix + "fullBackupContent="
                    + (fullBackupContent < 0 ? "false" : "true"));
        }
        if (networkSecurityConfigRes != 0) {
            pw.println(prefix + "networkSecurityConfigRes=0x"
                    + Integer.toHexString(networkSecurityConfigRes));
        }
        if (category != CATEGORY_UNDEFINED) {
            pw.println(prefix + "category=" + category);
        }
        pw.println(prefix + "HiddenApiEnforcementPolicy=" + getHiddenApiEnforcementPolicy());
        pw.println(prefix + "usesNonSdkApi=" + usesNonSdkApi());
        pw.println(prefix + "allowsPlaybackCapture="
                    + (isAudioPlaybackCaptureAllowed() ? "true" : "false"));
    }
    super.dumpBack(pw, prefix);
}
 
Example 16
Source File: ApplicationInfo.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
public void dump(Printer pw, String prefix) {
    super.dumpFront(pw, prefix);
    if (className != null) {
        pw.println(prefix + "className=" + className);
    }
    if (permission != null) {
        pw.println(prefix + "permission=" + permission);
    }
    pw.println(prefix + "processName=" + processName);
    pw.println(prefix + "taskAffinity=" + taskAffinity);
    pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
            + " theme=0x" + Integer.toHexString(theme));
    pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
            + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
            + " largestWidthLimitDp=" + largestWidthLimitDp);
    pw.println(prefix + "sourceDir=" + sourceDir);
    if (!Objects.equals(sourceDir, publicSourceDir)) {
        pw.println(prefix + "publicSourceDir=" + publicSourceDir);
    }
    if (!ArrayUtils.isEmpty(splitSourceDirs)) {
        pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
    }
    if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
            && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
        pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
    }
    if (resourceDirs != null) {
        pw.println(prefix + "resourceDirs=" + resourceDirs);
    }
    if (seinfo != null) {
        pw.println(prefix + "seinfo=" + seinfo);
    }
    pw.println(prefix + "dataDir=" + dataDir);
    if (sharedLibraryFiles != null) {
        pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
    }
    pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
            + " versionCode=" + versionCode);
    if (manageSpaceActivityName != null) {
        pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
    }
    if (descriptionRes != 0) {
        pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
    }
    if (uiOptions != 0) {
        pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
    }
    pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
    super.dumpBack(pw, prefix);
}
 
Example 17
Source File: ApplicationInfo.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/** @hide */
public void dump(Printer pw, String prefix, int dumpFlags) {
    super.dumpFront(pw, prefix);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && className != null) {
        pw.println(prefix + "className=" + className);
    }
    if (permission != null) {
        pw.println(prefix + "permission=" + permission);
    }
    pw.println(prefix + "processName=" + processName);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "taskAffinity=" + taskAffinity);
    }
    pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
            + " privateFlags=0x" + Integer.toHexString(privateFlags)
            + " theme=0x" + Integer.toHexString(theme));
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
                + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
                + " largestWidthLimitDp=" + largestWidthLimitDp);
    }
    pw.println(prefix + "sourceDir=" + sourceDir);
    if (!Objects.equals(sourceDir, publicSourceDir)) {
        pw.println(prefix + "publicSourceDir=" + publicSourceDir);
    }
    if (!ArrayUtils.isEmpty(splitSourceDirs)) {
        pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
    }
    if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
            && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
        pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
    }
    if (resourceDirs != null) {
        pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs));
    }
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0 && seInfo != null) {
        pw.println(prefix + "seinfo=" + seInfo);
        pw.println(prefix + "seinfoUser=" + seInfoUser);
    }
    pw.println(prefix + "dataDir=" + dataDir);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir);
        pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir);
        if (sharedLibraryFiles != null) {
            pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
        }
    }
    if (classLoaderName != null) {
        pw.println(prefix + "classLoaderName=" + classLoaderName);
    }
    if (!ArrayUtils.isEmpty(splitClassLoaderNames)) {
        pw.println(prefix + "splitClassLoaderNames=" + Arrays.toString(splitClassLoaderNames));
    }

    pw.println(prefix + "enabled=" + enabled
            + " minSdkVersion=" + minSdkVersion
            + " targetSdkVersion=" + targetSdkVersion
            + " versionCode=" + longVersionCode
            + " targetSandboxVersion=" + targetSandboxVersion);
    if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) {
        if (manageSpaceActivityName != null) {
            pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName);
        }
        if (descriptionRes != 0) {
            pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes));
        }
        if (uiOptions != 0) {
            pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
        }
        pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
        if (fullBackupContent > 0) {
            pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent);
        } else {
            pw.println(prefix + "fullBackupContent="
                    + (fullBackupContent < 0 ? "false" : "true"));
        }
        if (networkSecurityConfigRes != 0) {
            pw.println(prefix + "networkSecurityConfigRes=0x"
                    + Integer.toHexString(networkSecurityConfigRes));
        }
        if (category != CATEGORY_UNDEFINED) {
            pw.println(prefix + "category=" + category);
        }
        pw.println(prefix + "HiddenApiEnforcementPolicy=" + getHiddenApiEnforcementPolicy());
    }
    super.dumpBack(pw, prefix);
}
 
Example 18
Source File: ApplicationInfo.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
/** @hide */
public void dump(Printer pw, String prefix, int flags) {
    super.dumpFront(pw, prefix);
    if ((flags&DUMP_FLAG_DETAILS) != 0 && className != null) {
        pw.println(prefix + "className=" + className);
    }
    if (permission != null) {
        pw.println(prefix + "permission=" + permission);
    }
    pw.println(prefix + "processName=" + processName);
    if ((flags&DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "taskAffinity=" + taskAffinity);
    }
    pw.println(prefix + "uid=" + uid + " flags=0x" + Integer.toHexString(flags)
            + " privateFlags=0x" + Integer.toHexString(privateFlags)
            + " theme=0x" + Integer.toHexString(theme));
    if ((flags&DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "requiresSmallestWidthDp=" + requiresSmallestWidthDp
                + " compatibleWidthLimitDp=" + compatibleWidthLimitDp
                + " largestWidthLimitDp=" + largestWidthLimitDp);
    }
    pw.println(prefix + "sourceDir=" + sourceDir);
    if (!Objects.equals(sourceDir, publicSourceDir)) {
        pw.println(prefix + "publicSourceDir=" + publicSourceDir);
    }
    if (!ArrayUtils.isEmpty(splitSourceDirs)) {
        pw.println(prefix + "splitSourceDirs=" + Arrays.toString(splitSourceDirs));
    }
    if (!ArrayUtils.isEmpty(splitPublicSourceDirs)
            && !Arrays.equals(splitSourceDirs, splitPublicSourceDirs)) {
        pw.println(prefix + "splitPublicSourceDirs=" + Arrays.toString(splitPublicSourceDirs));
    }
    if (resourceDirs != null) {
        pw.println(prefix + "resourceDirs=" + Arrays.toString(resourceDirs));
    }
    if ((flags&DUMP_FLAG_DETAILS) != 0 && seinfo != null) {
        pw.println(prefix + "seinfo=" + seinfo);
    }
    pw.println(prefix + "dataDir=" + dataDir);
    if ((flags&DUMP_FLAG_DETAILS) != 0) {
        pw.println(prefix + "deviceProtectedDataDir=" + deviceProtectedDataDir);
        pw.println(prefix + "credentialProtectedDataDir=" + credentialProtectedDataDir);
        if (sharedLibraryFiles != null) {
            pw.println(prefix + "sharedLibraryFiles=" + Arrays.toString(sharedLibraryFiles));
        }
    }
    pw.println(prefix + "enabled=" + enabled
            + " minSdkVersion=" + minSdkVersion
            + " targetSdkVersion=" + targetSdkVersion
            + " versionCode=" + versionCode);
    if ((flags&DUMP_FLAG_DETAILS) != 0) {
        if (manageSpaceActivityName != null) {
            pw.println(prefix + "manageSpaceActivityName=" + manageSpaceActivityName);
        }
        if (descriptionRes != 0) {
            pw.println(prefix + "description=0x" + Integer.toHexString(descriptionRes));
        }
        if (uiOptions != 0) {
            pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
        }
        pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
        if (fullBackupContent > 0) {
            pw.println(prefix + "fullBackupContent=@xml/" + fullBackupContent);
        } else {
            pw.println(prefix + "fullBackupContent="
                    + (fullBackupContent < 0 ? "false" : "true"));
        }
        if (networkSecurityConfigRes != 0) {
            pw.println(prefix + "networkSecurityConfigRes=0x"
                    + Integer.toHexString(networkSecurityConfigRes));
        }
    }
    super.dumpBack(pw, prefix);
}
 
Example 19
Source File: SyntheticPasswordManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private boolean hasState(String stateName, long handle, int userId) {
    return !ArrayUtils.isEmpty(loadState(stateName, handle, userId));
}
 
Example 20
Source File: PermissionsState.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the global gids, applicable to all users.
 *
 * @param globalGids The global gids.
 */
public void setGlobalGids(int[] globalGids) {
    if (!ArrayUtils.isEmpty(globalGids)) {
        mGlobalGids = Arrays.copyOf(globalGids, globalGids.length);
    }
}