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

Commit 26b5bb14 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert the removal of FBE related checks." into rvc-dev am: b76fb5e7 am: 8051188e

Change-Id: I25b47b4874a365cc7f7aa3d1c4cf871e897cea64
parents 07710866 8051188e
Loading
Loading
Loading
Loading
+19 −19
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.SQLException;
@@ -49,8 +50,11 @@ import android.os.Bundle;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerWhitelistManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
import android.provider.Telephony;
import android.provider.Telephony.Sms.Intents;
import android.service.carrier.CarrierMessagingService;
@@ -661,22 +665,18 @@ public abstract class InboundSmsHandler extends StateMachine {
            return Intents.RESULT_SMS_HANDLED;
        }

//        // onlyCore indicates if the device is in cryptkeeper
//        boolean onlyCore = false;
//        try {
//            onlyCore = IPackageManager.Stub.asInterface(
//                    TelephonyFrameworkInitializer
//                            .getTelephonyServiceManager()
//                            .getPackageManagerServiceRegisterer()
//                            .get()).
//                    isOnlyCoreApps();
//        } catch (RemoteException e) {
//        }
//        if (onlyCore) {
//            // Device is unable to receive SMS in encrypted state
//            log("Received a short message in encrypted state. Rejecting.");
//            return Intents.RESULT_SMS_RECEIVED_WHILE_ENCRYPTED;
//        }
        // onlyCore indicates if the device is in cryptkeeper
        boolean onlyCore = false;
        try {
            onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService("package"))
                    .isOnlyCoreApps();
        } catch (RemoteException e) {
        }
        if (onlyCore) {
            // Device is unable to receive SMS in encrypted state
            log("Received a short message in encrypted state. Rejecting.");
            return Intents.RESULT_SMS_RECEIVED_WHILE_ENCRYPTED;
        }

        int result = dispatchMessageRadioSpecific(smsb);

@@ -1059,9 +1059,9 @@ public abstract class InboundSmsHandler extends StateMachine {
    @UnsupportedAppUsage
    private void showNewMessageNotification() {
        // Do not show the notification on non-FBE devices.
        // if (!StorageManager.isFileEncryptedNativeOrEmulated()) {
        //     return;
        // }
        if (!StorageManager.isFileEncryptedNativeOrEmulated()) {
            return;
        }
        log("Show new message notification.");
        PendingIntent intent = PendingIntent.getBroadcast(
            mContext,
+9 −13
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.RegistrantList;
import android.os.storage.StorageManager;
import android.sysprop.TelephonyProperties;
import android.telephony.PhoneCapability;
import android.telephony.SubscriptionManager;
@@ -100,20 +101,15 @@ public class PhoneConfigurationManager {

        mPhones = PhoneFactory.getPhones();

        /*
         * To support FDE (deprecated), additional check is needed:
         *
         * if (!StorageManager.inCryptKeeperBounce()) {
         *     // for loop below
         * } else {
         *     for (Phone phone : mPhones) {
         *         phone.mCi.registerForOn(mHandler, Phone.EVENT_RADIO_ON, phone);
         *     }
         * }
         */
        if (!StorageManager.inCryptKeeperBounce()) {
            for (Phone phone : mPhones) {
                phone.mCi.registerForAvailable(mHandler, Phone.EVENT_RADIO_AVAILABLE, phone);
            }
        } else {
            for (Phone phone : mPhones) {
                phone.mCi.registerForOn(mHandler, Phone.EVENT_RADIO_ON, phone);
            }
        }
    }

    private PhoneCapability getDefaultCapability() {
+6 −10
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.storage.StorageManager;
import android.preference.PreferenceManager;
import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
@@ -229,16 +230,11 @@ public class UiccController extends Handler {
        for (int i = 0; i < mCis.length; i++) {
            mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, i);

            /*
             * To support FDE (deprecated), additional check is needed:
             *
             * if (!StorageManager.inCryptKeeperBounce()) {
             *     mCis[i].registerForAvailable(this, EVENT_RADIO_AVAILABLE, i);
             * } else {
             *     mCis[i].registerForOn(this, EVENT_RADIO_ON, i);
             * }
             */
            if (!StorageManager.inCryptKeeperBounce()) {
                mCis[i].registerForAvailable(this, EVENT_RADIO_AVAILABLE, i);
            } else {
                mCis[i].registerForOn(this, EVENT_RADIO_ON, i);
            }

            mCis[i].registerForNotAvailable(this, EVENT_RADIO_UNAVAILABLE, i);
            mCis[i].registerForIccRefresh(this, EVENT_SIM_REFRESH, i);