From: Nathan Harold Date: Fri, 14 Jun 2019 23:56:05 +0000 (-0700) Subject: Use TM SubId in getDataState and getDataActivity X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9d2660041a7f4429aa0c632e424b83941dfe5d3c;p=android-x86%2Fframeworks-base.git Use TM SubId in getDataState and getDataActivity -Update getDataState() API to use the SubId specified by the TelephonyManager instance. -Update the getDataActivity() API to use the SubId specified by the TelephonyManager instance. (This CL is an un-revert of aosp/984377) Bug: 135205433 Test: manual (automated test is infeasible) Change-Id: I035f2c44a7955e88608b1c336acb72fb68c3e450 Merged-In: I035f2c44a7955e88608b1c336acb72fb68c3e450 --- diff --git a/config/hiddenapi-greylist-max-p.txt b/config/hiddenapi-greylist-max-p.txt index 141e8e669dac..25d45b0e6570 100644 --- a/config/hiddenapi-greylist-max-p.txt +++ b/config/hiddenapi-greylist-max-p.txt @@ -70,6 +70,8 @@ Lcom/android/internal/R$styleable;->MenuView:[I Lcom/android/internal/R$styleable;->Searchable:[I Lcom/android/internal/R$styleable;->SearchableActionKey:[I Lcom/android/internal/telephony/IPhoneSubInfo$Stub;->()V +Lcom/android/internal/telephony/ITelephony;->getDataActivity()I +Lcom/android/internal/telephony/ITelephony;->getDataState()I Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataActivity(I)V diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 6f60d334974d..5e8c4f78e18b 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4890,7 +4890,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_ACTIVITY_NONE; - return telephony.getDataActivity(); + return telephony.getDataActivityForSubId( + getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { // the phone process is restarting. return DATA_ACTIVITY_NONE; @@ -4938,7 +4939,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_DISCONNECTED; - return telephony.getDataState(); + return telephony.getDataStateForSubId( + getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { // the phone process is restarting. return DATA_DISCONNECTED; diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 5a27a0fb42e4..a2dcc78585eb 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -308,18 +308,46 @@ interface ITelephony { */ List getNeighboringCellInfo(String callingPkg); - @UnsupportedAppUsage - int getCallState(); + @UnsupportedAppUsage + int getCallState(); /** * Returns the call state for a slot. */ - int getCallStateForSlot(int slotIndex); + int getCallStateForSlot(int slotIndex); + + /** + * Replaced by getDataActivityForSubId. + */ + int getDataActivity(); + + /** + * Returns a constant indicating the type of activity on a data connection + * (cellular). + * + * @see #DATA_ACTIVITY_NONE + * @see #DATA_ACTIVITY_IN + * @see #DATA_ACTIVITY_OUT + * @see #DATA_ACTIVITY_INOUT + * @see #DATA_ACTIVITY_DORMANT + */ + int getDataActivityForSubId(int subId); + + /** + * Replaced by getDataStateForSubId. + */ + int getDataState(); - @UnsupportedAppUsage - int getDataActivity(); - @UnsupportedAppUsage - int getDataState(); + /** + * Returns a constant indicating the current data connection state + * (cellular). + * + * @see #DATA_DISCONNECTED + * @see #DATA_CONNECTING + * @see #DATA_CONNECTED + * @see #DATA_SUSPENDED + */ + int getDataStateForSubId(int subId); /** * Returns the current active phone type as integer.