Move factoryReset to service and protect.

bug:16161518
Change-Id: I02d1bbae1887c62ee426e6f03e8bc1f18c6666bf
This commit is contained in:
Stuart Scott
2015-04-02 18:00:02 -07:00
parent 19f1faa376
commit f1fb39763d
10 changed files with 72 additions and 62 deletions

View File

@@ -4550,15 +4550,12 @@ public class TelephonyManager {
* @hide
*/
public void factoryReset(int subId) {
if (SubscriptionManager.isUsableSubIdValue(subId)) {
// Enable data
setDataEnabled(subId, true);
// Set network selection mode to automatic
setNetworkSelectionModeAutomatic(subId);
// Set preferred mobile network type to the best available
setPreferredNetworkType(subId, RILConstants.PREFERRED_NETWORK_MODE);
// Turn off roaming
SubscriptionManager.from(mContext).setDataRoaming(0, subId);
try {
Log.d(TAG, "factoryReset: subId=" + subId);
ITelephony telephony = getITelephony();
if (telephony != null)
telephony.factoryReset(subId);
} catch (RemoteException e) {
}
}
}

View File

@@ -942,4 +942,6 @@ interface ITelephony {
* Returns the subscription ID associated with the specified PhoneAccount.
*/
int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
void factoryReset(int subId);
}