Merge "Correctly support restoring SIM specific settings" into main am: 98811d90e6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2678041 Change-Id: Icf7bc245bf040604ac83d4a6a8427106b1b1a63c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -174,7 +174,7 @@ public class SubscriptionManager {
|
|||||||
/**
|
/**
|
||||||
* Key to the backup & restore data byte array in the Bundle that is returned by {@link
|
* Key to the backup & restore data byte array in the Bundle that is returned by {@link
|
||||||
* #getAllSimSpecificSettingsForBackup()} or to be pass in to {@link
|
* #getAllSimSpecificSettingsForBackup()} or to be pass in to {@link
|
||||||
* #restoreAllSimSpecificSettings()}.
|
* #restoreAllSimSpecificSettingsFromBackup(byte[])}.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -4026,40 +4026,17 @@ public class SubscriptionManager {
|
|||||||
return bundle.getByteArray(SubscriptionManager.KEY_SIM_SPECIFIC_SETTINGS_DATA);
|
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
|
* 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
|
* configs to device for all existing SIMs in the subscription database {@link SimInfo}.
|
||||||
* data in an internal file. This file will persist on device for device's lifetime and will be
|
* Internally, it will store the backup data in an internal file. This file will persist on
|
||||||
* used later on when a SIM is inserted to restore that specific SIM's settings by calling
|
* device for device's lifetime and will be used later on when a SIM is inserted to restore that
|
||||||
* {@link #restoreSimSpecificSettingsForIccIdFromBackup(String iccId)}. End result is
|
* specific SIM's settings. End result is subscription database is modified to match any backed
|
||||||
* SimInfoDB is modified to match any backed up configs for the appropriate inserted SIMs.
|
* up configs for the appropriate inserted SIMs.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* The {@link Uri} {@link #SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI} is notified if any SimInfoDB
|
* The {@link Uri} {@link #SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI} is notified if any
|
||||||
* entry is updated as the result of this method call.
|
* {@link SimInfo} entry is updated as the result of this method call.
|
||||||
*
|
*
|
||||||
* @param data with the sim specific configs to be backed up.
|
* @param data with the sim specific configs to be backed up.
|
||||||
*
|
*
|
||||||
@@ -4068,12 +4045,18 @@ public class SubscriptionManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void restoreAllSimSpecificSettingsFromBackup(@NonNull byte[] data) {
|
public void restoreAllSimSpecificSettingsFromBackup(@NonNull byte[] data) {
|
||||||
Bundle bundle = new Bundle();
|
try {
|
||||||
bundle.putByteArray(KEY_SIM_SPECIFIC_SETTINGS_DATA, data);
|
ISub iSub = TelephonyManager.getSubscriptionService();
|
||||||
mContext.getContentResolver().call(
|
if (iSub != null) {
|
||||||
SIM_INFO_BACKUP_AND_RESTORE_CONTENT_URI,
|
iSub.restoreAllSimSpecificSettingsFromBackup(data);
|
||||||
RESTORE_SIM_SPECIFIC_SETTINGS_METHOD_NAME,
|
} else {
|
||||||
null, bundle);
|
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.
|
//TODO: Removed before U AOSP public release.
|
||||||
boolean isSubscriptionManagerServiceEnabled();
|
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