Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73036c40 authored by Jack Yu's avatar Jack Yu
Browse files

Added telephony display info support

Added the new APIs allowing clients like System UI to display
network icons correctly based on the provided telephony display
info.

Test: Telephony sanity tests
Bug: 148540139
Change-Id: I4dfb6eb7a313539e0565a4239d555426f12e503e
parent 6b1b31f0
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -47051,6 +47051,19 @@ package android.telephony {
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ClosedSubscriberGroupInfo> CREATOR;
  }
  public final class DisplayInfo implements android.os.Parcelable {
    method public int describeContents();
    method public int getNetworkType();
    method public int getOverrideNetworkType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DisplayInfo> CREATOR;
    field public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; // 0x2
    field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
    field public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; // 0x0
    field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; // 0x3
    field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
  }
  public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
    method public int describeContents();
    method public int getChannel();
@@ -47307,6 +47320,7 @@ package android.telephony {
    method public void onDataActivity(int);
    method public void onDataConnectionStateChanged(int);
    method public void onDataConnectionStateChanged(int, int);
    method @RequiresPermission("android.permission.READ_PHONE_STATE") public void onDisplayInfoChanged(@NonNull android.telephony.DisplayInfo);
    method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
    method public void onMessageWaitingIndicatorChanged(boolean);
    method @RequiresPermission("android.permission.MODIFY_PHONE_STATE") public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
@@ -47324,6 +47338,7 @@ package android.telephony {
    field public static final int LISTEN_CELL_LOCATION = 16; // 0x10
    field public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80
    field public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40
    field public static final int LISTEN_DISPLAY_INFO_CHANGED = 1048576; // 0x100000
    field public static final int LISTEN_EMERGENCY_NUMBER_LIST = 16777216; // 0x1000000
    field @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 134217728; // 0x8000000
    field public static final int LISTEN_MESSAGE_WAITING_INDICATOR = 4; // 0x4
+1 −0
Original line number Diff line number Diff line
@@ -12584,6 +12584,7 @@ package android.telephony {
    method public void notifyDataActivityChanged(int, int);
    method public void notifyDataConnectionForSubscriber(int, int, int, @Nullable android.telephony.PreciseDataConnectionState);
    method public void notifyDisconnectCause(int, int, int, int);
    method public void notifyDisplayInfoChanged(int, int, @NonNull android.telephony.DisplayInfo);
    method public void notifyEmergencyNumberList(int, int);
    method public void notifyImsDisconnectCause(int, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void notifyMessageWaitingChanged(int, int, boolean);
+1 −0
Original line number Diff line number Diff line
@@ -3709,6 +3709,7 @@ package android.telephony {
    method public void notifyDataActivityChanged(int, int);
    method public void notifyDataConnectionForSubscriber(int, int, int, @Nullable android.telephony.PreciseDataConnectionState);
    method public void notifyDisconnectCause(int, int, int, int);
    method public void notifyDisplayInfoChanged(int, int, @NonNull android.telephony.DisplayInfo);
    method public void notifyEmergencyNumberList(int, int);
    method public void notifyImsDisconnectCause(int, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void notifyMessageWaitingChanged(int, int, boolean);
+31 −0
Original line number Diff line number Diff line
@@ -300,6 +300,13 @@ public class PhoneStateListener {
     */
    public static final int LISTEN_USER_MOBILE_DATA_STATE                  = 0x00080000;

    /**
     *  Listen for display info changed event.
     *
     *  @see #onDisplayInfoChanged
     */
    public static final int LISTEN_DISPLAY_INFO_CHANGED = 0x00100000;

    /**
     *  Listen for changes to the phone capability.
     *
@@ -847,6 +854,21 @@ public class PhoneStateListener {
        // default implementation empty
    }

    /**
     * Callback invoked when the display info has changed on the registered subscription.
     * <p> The {@link DisplayInfo} contains status information shown to the user based on
     * carrier policy.
     *
     * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling
     * app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}).
     *
     * @param displayInfo The display information.
     */
    @RequiresPermission((android.Manifest.permission.READ_PHONE_STATE))
    public void onDisplayInfoChanged(@NonNull DisplayInfo displayInfo) {
        // default implementation empty
    }

    /**
     * Callback invoked when the current emergency number list has changed on the registered
     * subscription.
@@ -1226,6 +1248,15 @@ public class PhoneStateListener {
                            () -> psl.onUserMobileDataStateChanged(enabled)));
        }

        public void onDisplayInfoChanged(DisplayInfo displayInfo) {
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            if (psl == null) return;

            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(
                            () -> psl.onDisplayInfoChanged(displayInfo)));
        }

        public void onOemHookRawEvent(byte[] rawData) {
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            if (psl == null) return;
+18 −0
Original line number Diff line number Diff line
@@ -588,6 +588,24 @@ public class TelephonyRegistryManager {
        }
    }

    /**
     * Notify display info changed.
     *
     * @param slotIndex The SIM slot index for which display info has changed. Can be
     * derived from {@code subscriptionId} except when {@code subscriptionId} is invalid, such as
     * when the device is in emergency-only mode.
     * @param subscriptionId Subscription id for which display network info has changed.
     * @param displayInfo The display info.
     */
    public void notifyDisplayInfoChanged(int slotIndex, int subscriptionId,
                                         @NonNull DisplayInfo displayInfo) {
        try {
            sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, displayInfo);
        } catch (RemoteException ex) {
            // system process is dead
        }
    }

    /**
     * Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}.
     *
Loading