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

Commit 6b4339e1 authored by Michele Berionne's avatar Michele Berionne
Browse files

Add SIM PIN caching availability in dump

Bug: 188249618
Test: manual - adb shell dumpsys activity service TelephonyDebugService
Change-Id: I084322086da7df7e4e0232a841c2613447e3da41
Merged-In: I084322086da7df7e4e0232a841c2613447e3da41
parent 6895ab85
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -937,13 +937,21 @@ public class PinStorage extends Handler {


    /** Returns if the PIN cache is allowed for a given slot. */
    /** Returns if the PIN cache is allowed for a given slot. */
    private boolean isCacheAllowed(int slotId) {
    private boolean isCacheAllowed(int slotId) {
        // Check overall device support
        return isCacheAllowedByDevice() && isCacheAllowedByCarrier(slotId);
    }

    /** Returns if the PIN cache is allowed by the device. */
    private boolean isCacheAllowedByDevice() {
        if (!mContext.getResources().getBoolean(
        if (!mContext.getResources().getBoolean(
                R.bool.config_allow_pin_storage_for_unattended_reboot)) {
                R.bool.config_allow_pin_storage_for_unattended_reboot)) {
            logv("Pin caching disabled in resources");
            logv("Pin caching disabled in resources");
            return false;
            return false;
        }
        }
        // Check carrier configuration
        return true;
    }

    /** Returns if the PIN cache is allowed by carrier for a given slot. */
    private boolean isCacheAllowedByCarrier(int slotId) {
        PersistableBundle config = null;
        PersistableBundle config = null;
        CarrierConfigManager configManager =
        CarrierConfigManager configManager =
                mContext.getSystemService(CarrierConfigManager.class);
                mContext.getSystemService(CarrierConfigManager.class);
@@ -1161,6 +1169,11 @@ public class PinStorage extends Handler {
        pw.println(" mIsDeviceLocked=" + mIsDeviceLocked);
        pw.println(" mIsDeviceLocked=" + mIsDeviceLocked);
        pw.println(" isLongTermSecretKey=" + (boolean) (mLongTermSecretKey != null));
        pw.println(" isLongTermSecretKey=" + (boolean) (mLongTermSecretKey != null));
        pw.println(" isShortTermSecretKey=" + (boolean) (mShortTermSecretKey != null));
        pw.println(" isShortTermSecretKey=" + (boolean) (mShortTermSecretKey != null));
        pw.println(" isCacheAllowedByDevice=" + isCacheAllowedByDevice());
        int slotCount = getSlotCount();
        for (int i = 0; i < slotCount; i++) {
            pw.println(" isCacheAllowedByCarrier[" + i + "]=" + isCacheAllowedByCarrier(i));
        }
        if (VDBG) {
        if (VDBG) {
            SparseArray<StoredPin> storedPins = loadPinInformation();
            SparseArray<StoredPin> storedPins = loadPinInformation();
            for (int i = 0; i < storedPins.size(); i++) {
            for (int i = 0; i < storedPins.size(); i++) {