Merge "Introduce AlternativeNetwork APIs"
This commit is contained in:
@@ -550,6 +550,7 @@ java_defaults {
|
|||||||
"telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl",
|
"telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/ISms.aidl",
|
"telephony/java/com/android/internal/telephony/ISms.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/ISub.aidl",
|
"telephony/java/com/android/internal/telephony/ISub.aidl",
|
||||||
|
"telephony/java/com/android/internal/telephony/IAns.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/ITelephony.aidl",
|
"telephony/java/com/android/internal/telephony/ITelephony.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl",
|
"telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/IWapPushManager.aidl",
|
"telephony/java/com/android/internal/telephony/IWapPushManager.aidl",
|
||||||
|
|||||||
@@ -42637,6 +42637,7 @@ package android.telephony {
|
|||||||
method public static int getDefaultSubscriptionId();
|
method public static int getDefaultSubscriptionId();
|
||||||
method public static int getDefaultVoiceSubscriptionId();
|
method public static int getDefaultVoiceSubscriptionId();
|
||||||
method public static int[] getSubscriptionIds(int);
|
method public static int[] getSubscriptionIds(int);
|
||||||
|
method public java.util.List<android.telephony.SubscriptionInfo> getOpportunisticSubscriptions(int);
|
||||||
method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);
|
method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);
|
||||||
method public boolean isActiveSubscriptionId(int);
|
method public boolean isActiveSubscriptionId(int);
|
||||||
method public boolean isNetworkRoaming(int);
|
method public boolean isNetworkRoaming(int);
|
||||||
|
|||||||
@@ -2226,20 +2226,21 @@ public class SubscriptionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get User downloaded Profiles.
|
* Get opportunistic data Profiles.
|
||||||
*
|
*
|
||||||
* Provide all available user downloaded profile on the phone.
|
* Provide all available user downloaded profiles on phone which are used only for
|
||||||
* @param slotId on which phone the switch will operate on
|
* opportunistic data.
|
||||||
|
* @param slotIndex slot on which the profiles are queried from.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||||
List<SubscriptionInfo> getOpportunisticSubscriptions(int slotId) {
|
public List<SubscriptionInfo> getOpportunisticSubscriptions(int slotIndex) {
|
||||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||||
List<SubscriptionInfo> subInfoList = null;
|
List<SubscriptionInfo> subInfoList = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||||
if (iSub != null) {
|
if (iSub != null) {
|
||||||
subInfoList = iSub.getOpportunisticSubscriptions(slotId, pkgForDebug);
|
subInfoList = iSub.getOpportunisticSubscriptions(slotIndex, pkgForDebug);
|
||||||
}
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// ignore it
|
// ignore it
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import com.android.ims.internal.IImsServiceFeatureCallback;
|
|||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.telecom.ITelecomService;
|
import com.android.internal.telecom.ITelecomService;
|
||||||
import com.android.internal.telephony.CellNetworkScanResult;
|
import com.android.internal.telephony.CellNetworkScanResult;
|
||||||
|
import com.android.internal.telephony.IAns;
|
||||||
import com.android.internal.telephony.IPhoneSubInfo;
|
import com.android.internal.telephony.IPhoneSubInfo;
|
||||||
import com.android.internal.telephony.ITelephony;
|
import com.android.internal.telephony.ITelephony;
|
||||||
import com.android.internal.telephony.ITelephonyRegistry;
|
import com.android.internal.telephony.ITelephonyRegistry;
|
||||||
@@ -4420,6 +4421,10 @@ public class TelephonyManager {
|
|||||||
return ITelephonyRegistry.Stub.asInterface(ServiceManager.getService("telephony.registry"));
|
return ITelephonyRegistry.Stub.asInterface(ServiceManager.getService("telephony.registry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IAns getIAns() {
|
||||||
|
return IAns.Stub.asInterface(ServiceManager.getService("ians"));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// PhoneStateListener
|
// PhoneStateListener
|
||||||
@@ -8611,7 +8616,6 @@ public class TelephonyManager {
|
|||||||
return UNKNOWN_CARRIER_ID_LIST_VERSION;
|
return UNKNOWN_CARRIER_ID_LIST_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many modems can have simultaneous data connections.
|
* How many modems can have simultaneous data connections.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -8629,4 +8633,62 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable AlternativeNetworkService.
|
||||||
|
*
|
||||||
|
* This method should be called to enable or disable
|
||||||
|
* AlternativeNetwork service on the device.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
|
||||||
|
*
|
||||||
|
* @param enable enable(True) or disable(False)
|
||||||
|
* @return returns true if successfully set.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
|
public boolean setAlternativeNetworkState(boolean enable) {
|
||||||
|
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||||
|
boolean ret = false;
|
||||||
|
try {
|
||||||
|
IAns iAlternativeNetworkService = getIAns();
|
||||||
|
if (iAlternativeNetworkService != null) {
|
||||||
|
ret = iAlternativeNetworkService.setEnable(enable, pkgForDebug);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
Rlog.e(TAG, "enableAlternativeNetwork RemoteException", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is AlternativeNetworkService enabled
|
||||||
|
*
|
||||||
|
* This method should be called to determine if the AlternativeNetworkService is
|
||||||
|
* enabled
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||||
|
public boolean isAlternativeNetworkEnabled() {
|
||||||
|
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||||
|
boolean isEnabled = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
IAns iAlternativeNetworkService = getIAns();
|
||||||
|
if (iAlternativeNetworkService != null) {
|
||||||
|
isEnabled = iAlternativeNetworkService.isEnabled(pkgForDebug);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
Rlog.e(TAG, "enableAlternativeNetwork RemoteException", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
52
telephony/java/com/android/internal/telephony/IAns.aidl
Executable file
52
telephony/java/com/android/internal/telephony/IAns.aidl
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.internal.telephony;
|
||||||
|
|
||||||
|
|
||||||
|
interface IAns {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable Alternative Network service.
|
||||||
|
*
|
||||||
|
* This method should be called to enable or disable
|
||||||
|
* AlternativeNetwork service on the device.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
|
||||||
|
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
|
||||||
|
*
|
||||||
|
* @param enable enable(True) or disable(False)
|
||||||
|
* @param callingPackage caller's package name
|
||||||
|
* @return returns true if successfully set.
|
||||||
|
*/
|
||||||
|
boolean setEnable(boolean enable, String callingPackage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is Alternative Network service enabled
|
||||||
|
*
|
||||||
|
* This method should be called to determine if the Alternative Network service is enabled
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Requires Permission:
|
||||||
|
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
|
* Or the calling app has carrier privileges. @see #hasCarrierPrivileges
|
||||||
|
*
|
||||||
|
* @param callingPackage caller's package name
|
||||||
|
*/
|
||||||
|
boolean isEnabled(String callingPackage);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user