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

Commit ae77970a authored by Michele Berionne's avatar Michele Berionne
Browse files

Add new API for unattended reboot.

CTS-Coverage-Bug: 179310594
Bug: 160784387
Test: manual
Change-Id: I59b7ff7afec9846a114ee8d20f14d22cf69f0680
Merged-In: I59b7ff7afec9846a114ee8d20f14d22cf69f0680
(cherry picked from commit 726fa0a5)
parent 1c276e75
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -10541,6 +10541,7 @@ package android.telephony {
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean matchesCurrentSimOperator(@NonNull String, int, @Nullable String);
    method public boolean needsOtaServiceProvisioning();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyOtaEmergencyNumberDbInstalled();
    method @RequiresPermission(android.Manifest.permission.REBOOT) public int prepareForUnattendedReboot();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void reportDefaultNetworkStatus(boolean);
    method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
@@ -10660,6 +10661,9 @@ package android.telephony {
    field public static final int NR_DUAL_CONNECTIVITY_DISABLE = 2; // 0x2
    field public static final int NR_DUAL_CONNECTIVITY_DISABLE_IMMEDIATE = 3; // 0x3
    field public static final int NR_DUAL_CONNECTIVITY_ENABLE = 1; // 0x1
    field public static final int PREPARE_UNATTENDED_REBOOT_ERROR = 2; // 0x2
    field public static final int PREPARE_UNATTENDED_REBOOT_PIN_REQUIRED = 1; // 0x1
    field public static final int PREPARE_UNATTENDED_REBOOT_SUCCESS = 0; // 0x0
    field public static final int RADIO_POWER_OFF = 0; // 0x0
    field public static final int RADIO_POWER_ON = 1; // 0x1
    field public static final int RADIO_POWER_UNAVAILABLE = 2; // 0x2
+3 −0
Original line number Diff line number Diff line
@@ -4414,4 +4414,7 @@

    <!-- Whether to select voice/data/sms preference without user confirmation -->
    <bool name="config_voice_data_sms_auto_fallback">false</bool>

    <!-- Whether to allow the caching of the SIM PIN for verification after unattended reboot -->
    <bool name="config_allow_pin_storage_for_unattended_reboot">true</bool>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -2612,6 +2612,7 @@
  <java-symbol type="bool" name="config_defaultWindowFeatureContextMenu" />
  <java-symbol type="bool" name="config_overrideRemoteViewsActivityTransition" />
  <java-symbol type="attr" name="colorProgressBackgroundNormal" />
  <java-symbol type="bool" name="config_allow_pin_storage_for_unattended_reboot" />

  <java-symbol type="layout" name="simple_account_item" />
  <java-symbol type="string" name="prohibit_manual_network_selection_in_gobal_mode" />
+16 −0
Original line number Diff line number Diff line
@@ -4157,6 +4157,21 @@ public class CarrierConfigManager {
    public static final String KEY_ALLOWED_INITIAL_ATTACH_APN_TYPES_STRING_ARRAY =
            "allowed_initial_attach_apn_types_string_array";

    /**
     * Boolean indicating whether the SIM PIN can be stored and verified
     * seamlessly after an unattended reboot.
     *
     * The device configuration value {@code config_allow_pin_storage_for_unattended_reboot}
     * ultimately controls whether this carrier configuration option is used.  Where
     * {@code config_allow_pin_storage_for_unattended_reboot} is false, the value of the
     * {@link #KEY_STORE_SIM_PIN_FOR_UNATTENDED_REBOOT_BOOL} carrier configuration option is
     * ignored.
     *
     * @hide
     */
    public static final String KEY_STORE_SIM_PIN_FOR_UNATTENDED_REBOOT_BOOL =
            "store_sim_pin_for_unattended_reboot_bool";

    /** The default value for every variable. */
    private final static PersistableBundle sDefaults;

@@ -4710,6 +4725,7 @@ public class CarrierConfigManager {
        sDefaults.putInt(KEY_DEFAULT_RTT_MODE_INT, 0);
        sDefaults.putStringArray(KEY_ALLOWED_INITIAL_ATTACH_APN_TYPES_STRING_ARRAY,
                new String[]{"ia", "default", "ims", "mms", "dun", "emergency"});
        sDefaults.putBoolean(KEY_STORE_SIM_PIN_FOR_UNATTENDED_REBOOT_BOOL, true);
    }

    /**
+62 −2
Original line number Diff line number Diff line
@@ -121,12 +121,10 @@ import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
@@ -14824,4 +14822,66 @@ public class TelephonyManager {
            Log.e(TAG, "Error calling ITelephony#clearSignalStrengthUpdateRequest", e);
        }
    }
    /**
     * The unattended reboot was prepared successfully.
     * @hide
     */
    @SystemApi
    public static final int PREPARE_UNATTENDED_REBOOT_SUCCESS = 0;
    /**
     * The unattended reboot was prepared, but the user will need to manually
     * enter the PIN code of at least one SIM card present in the device.
     * @hide
     */
    @SystemApi
    public static final int PREPARE_UNATTENDED_REBOOT_PIN_REQUIRED = 1;
    /**
     * The unattended reboot was not prepared due to generic error.
     * @hide
     */
    @SystemApi
    public static final int PREPARE_UNATTENDED_REBOOT_ERROR = 2;
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"PREPARE_UNATTENDED_REBOOT_"},
            value = {
                    PREPARE_UNATTENDED_REBOOT_SUCCESS,
                    PREPARE_UNATTENDED_REBOOT_PIN_REQUIRED,
                    PREPARE_UNATTENDED_REBOOT_ERROR
            })
    public @interface PrepareUnattendedRebootResult {}
    /**
     * Prepare TelephonyManager for an unattended reboot. The reboot is required to be done
     * shortly (e.g. within 15 seconds) after the API is invoked.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#REBOOT}
     *
     * @return {@link #PREPARE_UNATTENDED_REBOOT_SUCCESS} in case of success.
     * {@link #PREPARE_UNATTENDED_REBOOT_PIN_REQUIRED} if the device contains
     * at least one SIM card for which the user needs to manually enter the PIN
     * code after the reboot. {@link #PREPARE_UNATTENDED_REBOOT_ERROR} in case
     * of error.
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.REBOOT)
    @PrepareUnattendedRebootResult
    public int prepareForUnattendedReboot() {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.prepareForUnattendedReboot();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Telephony#prepareForUnattendedReboot RemoteException", e);
            e.rethrowFromSystemServer();
        }
        return PREPARE_UNATTENDED_REBOOT_ERROR;
    }
}
Loading