Merge "Correctly support restoring SIM specific settings"
This commit is contained in:
committed by
Android (Google) Code Review
commit
effe0ad891
@@ -174,7 +174,7 @@ public class SubscriptionManager {
|
||||
/**
|
||||
* Key to the backup & restore data byte array in the Bundle that is returned by {@link
|
||||
* #getAllSimSpecificSettingsForBackup()} or to be pass in to {@link
|
||||
* #restoreAllSimSpecificSettings()}.
|
||||
* #restoreAllSimSpecificSettingsFromBackup(byte[])}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@@ -4050,40 +4050,17 @@ public class SubscriptionManager {
|
||||
return bundle.getByteArray(SubscriptionManager.KEY_SIM_SPECIFIC_SETTINGS_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to attempt to restore the backed up sim-specific configs to device for specific sim.
|
||||
* This will try to restore the data that was stored internally when {@link
|
||||
* #restoreAllSimSpecificSettingsFromBackup(byte[] data)} was called during setup wizard.
|
||||
* End result is SimInfoDB is modified to match any backed up configs for the requested
|
||||
* inserted sim.
|
||||
*
|
||||
* <p>
|
||||
* The {@link Uri} {@link #SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI} is notified if any SimInfoDB
|
||||
* entry is updated as the result of this method call.
|
||||
*
|
||||
* @param iccId of the sim that a restore is requested for.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||
public void restoreSimSpecificSettingsForIccIdFromBackup(@NonNull String iccId) {
|
||||
mContext.getContentResolver().call(
|
||||
SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI,
|
||||
RESTORE_SIM_SPECIFIC_SETTINGS_METHOD_NAME,
|
||||
iccId, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called during setup wizard restore flow to attempt to restore the backed up sim-specific
|
||||
* configs to device for all existing SIMs in SimInfoDB. Internally, it will store the backup
|
||||
* data in an internal file. This file will persist on device for device's lifetime and will be
|
||||
* used later on when a SIM is inserted to restore that specific SIM's settings by calling
|
||||
* {@link #restoreSimSpecificSettingsForIccIdFromBackup(String iccId)}. End result is
|
||||
* SimInfoDB is modified to match any backed up configs for the appropriate inserted SIMs.
|
||||
* configs to device for all existing SIMs in the subscription database {@link SimInfo}.
|
||||
* Internally, it will store the backup data in an internal file. This file will persist on
|
||||
* device for device's lifetime and will be used later on when a SIM is inserted to restore that
|
||||
* specific SIM's settings. End result is subscription database is modified to match any backed
|
||||
* up configs for the appropriate inserted SIMs.
|
||||
*
|
||||
* <p>
|
||||
* The {@link Uri} {@link #SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI} is notified if any SimInfoDB
|
||||
* entry is updated as the result of this method call.
|
||||
* The {@link Uri} {@link #SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI} is notified if any
|
||||
* {@link SimInfo} entry is updated as the result of this method call.
|
||||
*
|
||||
* @param data with the sim specific configs to be backed up.
|
||||
*
|
||||
@@ -4092,12 +4069,18 @@ public class SubscriptionManager {
|
||||
@SystemApi
|
||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||
public void restoreAllSimSpecificSettingsFromBackup(@NonNull byte[] data) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putByteArray(KEY_SIM_SPECIFIC_SETTINGS_DATA, data);
|
||||
mContext.getContentResolver().call(
|
||||
SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI,
|
||||
RESTORE_SIM_SPECIFIC_SETTINGS_METHOD_NAME,
|
||||
null, bundle);
|
||||
try {
|
||||
ISub iSub = TelephonyManager.getSubscriptionService();
|
||||
if (iSub != null) {
|
||||
iSub.restoreAllSimSpecificSettingsFromBackup(data);
|
||||
} else {
|
||||
throw new IllegalStateException("subscription service unavailable.");
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
if (!isSystemProcess()) {
|
||||
ex.rethrowAsRuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -363,4 +363,20 @@ interface ISub {
|
||||
*/
|
||||
//TODO: Removed before U AOSP public release.
|
||||
boolean isSubscriptionManagerServiceEnabled();
|
||||
|
||||
/**
|
||||
* Called during setup wizard restore flow to attempt to restore the backed up sim-specific
|
||||
* configs to device for all existing SIMs in the subscription database
|
||||
* {@link Telephony.SimInfo}. Internally, it will store the backup data in an internal file.
|
||||
* This file will persist on device for device's lifetime and will be used later on when a SIM
|
||||
* is inserted to restore that specific SIM's settings. End result is subscription database is
|
||||
* modified to match any backed up configs for the appropriate inserted SIMs.
|
||||
*
|
||||
* <p>
|
||||
* The {@link Uri} {@link #SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI} is notified if any
|
||||
* {@link Telephony.SimInfo} entry is updated as the result of this method call.
|
||||
*
|
||||
* @param data with the sim specific configs to be backed up.
|
||||
*/
|
||||
void restoreAllSimSpecificSettingsFromBackup(in byte[] data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user