Merge "Add/Fix Permission check on SubscriptionManager." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8b0f3873a0
@@ -51,7 +51,7 @@
|
|||||||
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
|
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PRIVILEDGED_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" />
|
<uses-permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" />
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ public class SubscriptionManager {
|
|||||||
* onSubscriptionsChanged overridden.
|
* onSubscriptionsChanged overridden.
|
||||||
*/
|
*/
|
||||||
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
|
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
|
||||||
String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>";
|
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
logd("register OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
|
logd("register OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
|
||||||
+ " listener=" + listener);
|
+ " listener=" + listener);
|
||||||
@@ -361,7 +361,7 @@ public class SubscriptionManager {
|
|||||||
* @param listener that is to be unregistered.
|
* @param listener that is to be unregistered.
|
||||||
*/
|
*/
|
||||||
public void removeOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
|
public void removeOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
|
||||||
String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>";
|
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
logd("unregister OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
|
logd("unregister OnSubscriptionsChangedListener pkgForDebug=" + pkgForDebug
|
||||||
+ " listener=" + listener);
|
+ " listener=" + listener);
|
||||||
@@ -603,7 +603,7 @@ public class SubscriptionManager {
|
|||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
// FIXME: This returns 1 on success, 0 on error should should we return it?
|
// FIXME: This returns 1 on success, 0 on error should should we return it?
|
||||||
iSub.addSubInfoRecord(iccId, slotId, mContext.getOpPackageName());
|
iSub.addSubInfoRecord(iccId, slotId);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -633,7 +633,7 @@ public class SubscriptionManager {
|
|||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
result = iSub.setIconTint(tint, subId, mContext.getOpPackageName());
|
result = iSub.setIconTint(tint, subId);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -678,8 +678,7 @@ public class SubscriptionManager {
|
|||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
result = iSub.setDisplayNameUsingSrc(displayName, subId, nameSource,
|
result = iSub.setDisplayNameUsingSrc(displayName, subId, nameSource);
|
||||||
mContext.getOpPackageName());
|
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -707,7 +706,7 @@ public class SubscriptionManager {
|
|||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
result = iSub.setDisplayNumber(number, subId, mContext.getOpPackageName());
|
result = iSub.setDisplayNumber(number, subId);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -736,7 +735,7 @@ public class SubscriptionManager {
|
|||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
result = iSub.setDataRoaming(roaming, subId, mContext.getOpPackageName());
|
result = iSub.setDataRoaming(roaming, subId);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -975,7 +974,7 @@ public class SubscriptionManager {
|
|||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
iSub.clearSubInfo(mContext.getOpPackageName());
|
iSub.clearSubInfo();
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -1009,7 +1008,7 @@ public class SubscriptionManager {
|
|||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
iSub.clearDefaultsForInactiveSubIds(mContext.getOpPackageName());
|
iSub.clearDefaultsForInactiveSubIds();
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -1153,4 +1152,3 @@ public class SubscriptionManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ interface ISub {
|
|||||||
List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage);
|
List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param callingPackage The package maing the call.
|
* @param callingPackage The package making the call.
|
||||||
* @return the number of active subscriptions
|
* @return the number of active subscriptions
|
||||||
*/
|
*/
|
||||||
int getActiveSubInfoCount(String callingPackage);
|
int getActiveSubInfoCount(String callingPackage);
|
||||||
@@ -97,57 +97,50 @@ interface ISub {
|
|||||||
* Add a new SubscriptionInfo to subinfo database if needed
|
* Add a new SubscriptionInfo to subinfo database if needed
|
||||||
* @param iccId the IccId of the SIM card
|
* @param iccId the IccId of the SIM card
|
||||||
* @param slotId the slot which the SIM is inserted
|
* @param slotId the slot which the SIM is inserted
|
||||||
* @param callingPackage The package maing the call.
|
|
||||||
* @return the URL of the newly created row or the updated row
|
* @return the URL of the newly created row or the updated row
|
||||||
*/
|
*/
|
||||||
int addSubInfoRecord(String iccId, int slotId, String callingPackage);
|
int addSubInfoRecord(String iccId, int slotId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set SIM icon tint color by simInfo index
|
* Set SIM icon tint color by simInfo index
|
||||||
* @param tint the icon tint color of the SIM
|
* @param tint the icon tint color of the SIM
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @param callingPackage The package maing the call.
|
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setIconTint(int tint, int subId, String callingPackage);
|
int setIconTint(int tint, int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set display name by simInfo index
|
* Set display name by simInfo index
|
||||||
* @param displayName the display name of SIM card
|
* @param displayName the display name of SIM card
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @param callingPackage The package maing the call.
|
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setDisplayName(String displayName, int subId, String callingPackage);
|
int setDisplayName(String displayName, int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set display name by simInfo index with name source
|
* Set display name by simInfo index with name source
|
||||||
* @param displayName the display name of SIM card
|
* @param displayName the display name of SIM card
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
|
* @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
|
||||||
* @param callingPackage The package maing the call.
|
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setDisplayNameUsingSrc(String displayName, int subId, long nameSource,
|
int setDisplayNameUsingSrc(String displayName, int subId, long nameSource);
|
||||||
String callingPackage);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set phone number by subId
|
* Set phone number by subId
|
||||||
* @param number the phone number of the SIM
|
* @param number the phone number of the SIM
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @param callingPackage The package maing the call.
|
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setDisplayNumber(String number, int subId, String callingPackage);
|
int setDisplayNumber(String number, int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set data roaming by simInfo index
|
* Set data roaming by simInfo index
|
||||||
* @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
|
* @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
|
||||||
* @param callingPackage The package maing the call.
|
|
||||||
* @param subId the unique SubscriptionInfo index in database
|
* @param subId the unique SubscriptionInfo index in database
|
||||||
* @return the number of records updated
|
* @return the number of records updated
|
||||||
*/
|
*/
|
||||||
int setDataRoaming(int roaming, int subId, String callingPackage);
|
int setDataRoaming(int roaming, int subId);
|
||||||
|
|
||||||
int getSlotId(int subId);
|
int getSlotId(int subId);
|
||||||
|
|
||||||
@@ -155,7 +148,7 @@ interface ISub {
|
|||||||
|
|
||||||
int getDefaultSubId();
|
int getDefaultSubId();
|
||||||
|
|
||||||
int clearSubInfo(String callingPackage);
|
int clearSubInfo();
|
||||||
|
|
||||||
int getPhoneId(int subId);
|
int getPhoneId(int subId);
|
||||||
|
|
||||||
@@ -175,7 +168,7 @@ interface ISub {
|
|||||||
|
|
||||||
void setDefaultSmsSubId(int subId);
|
void setDefaultSmsSubId(int subId);
|
||||||
|
|
||||||
void clearDefaultsForInactiveSubIds(String callingPackage);
|
void clearDefaultsForInactiveSubIds();
|
||||||
|
|
||||||
int[] getActiveSubIdList();
|
int[] getActiveSubIdList();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user