Merge "Fix NPE in calling getSubscriptionPlans method." into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d4c36badff
@@ -31,14 +31,13 @@ import android.os.Message;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
||||||
import com.android.internal.telephony.ISub;
|
import com.android.internal.telephony.ISub;
|
||||||
import com.android.internal.telephony.ITelephonyRegistry;
|
import com.android.internal.telephony.ITelephonyRegistry;
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +58,7 @@ public class SubscriptionManager {
|
|||||||
|
|
||||||
/** Base value for Dummy SUBSCRIPTION_ID's. */
|
/** Base value for Dummy SUBSCRIPTION_ID's. */
|
||||||
/** FIXME: Remove DummySubId's, but for now have them map just below INVALID_SUBSCRIPTION_ID
|
/** FIXME: Remove DummySubId's, but for now have them map just below INVALID_SUBSCRIPTION_ID
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int DUMMY_SUBSCRIPTION_ID_BASE = INVALID_SUBSCRIPTION_ID - 1;
|
public static final int DUMMY_SUBSCRIPTION_ID_BASE = INVALID_SUBSCRIPTION_ID - 1;
|
||||||
|
|
||||||
/** An invalid phone identifier */
|
/** An invalid phone identifier */
|
||||||
@@ -368,7 +367,7 @@ public class SubscriptionManager {
|
|||||||
*/
|
*/
|
||||||
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
||||||
public static final String SUB_DEFAULT_CHANGED_ACTION =
|
public static final String SUB_DEFAULT_CHANGED_ACTION =
|
||||||
"android.intent.action.SUB_DEFAULT_CHANGED";
|
"android.intent.action.SUB_DEFAULT_CHANGED";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast Action: The default subscription has changed. This has the following
|
* Broadcast Action: The default subscription has changed. This has the following
|
||||||
@@ -621,7 +620,7 @@ public class SubscriptionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = new ArrayList<SubscriptionInfo>();
|
result = new ArrayList<>();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1450,8 +1449,8 @@ 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) {
|
||||||
resultValue = iSub.getSubscriptionProperty(subId, propKey,
|
resultValue = iSub.getSubscriptionProperty(subId, propKey,
|
||||||
context.getOpPackageName());
|
context.getOpPackageName());
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
@@ -1560,8 +1559,10 @@ public class SubscriptionManager {
|
|||||||
final INetworkPolicyManager npm = INetworkPolicyManager.Stub
|
final INetworkPolicyManager npm = INetworkPolicyManager.Stub
|
||||||
.asInterface(ServiceManager.getService(Context.NETWORK_POLICY_SERVICE));
|
.asInterface(ServiceManager.getService(Context.NETWORK_POLICY_SERVICE));
|
||||||
try {
|
try {
|
||||||
return Arrays.asList(npm.getSubscriptionPlans(subId,
|
SubscriptionPlan[] subscriptionPlans =
|
||||||
mContext.getOpPackageName()));
|
npm.getSubscriptionPlans(subId, mContext.getOpPackageName());
|
||||||
|
return subscriptionPlans == null
|
||||||
|
? Collections.emptyList() : Arrays.asList(subscriptionPlans);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user