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

Commit 5c9dc2cb authored by Michael Groover's avatar Michael Groover
Browse files

Add cellular null cipher transparency system APIs

This commit adds two new system APIs to support celluar null cipher
transparency. These APIs will allow setting and getting whether
the notifications should be sent when the modem switches to / from
a null cipher.

Bug: 316592273
Test: atest TelephonyManagerTest
Change-Id: I38e0bd069e60ff245ba7ab645c073a1aeca83fd2
parent 442fbea9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14672,6 +14672,7 @@ package android.telephony {
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isLteCdmaEvdoGsmWcdmaEnabled();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isMobileDataPolicyEnabled(int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isNrDualConnectivityEnabled();
    method @FlaggedApi("com.android.internal.telephony.flags.enable_modem_cipher_transparency") @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isNullCipherNotificationsEnabled();
    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isOpportunisticNetworkEnabled();
    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
@@ -14711,6 +14712,7 @@ package android.telephony {
    method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
    method @FlaggedApi("com.android.internal.telephony.flags.enable_identifier_disclosure_transparency") @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setEnableCellularIdentifierDisclosureNotifications(boolean);
    method @FlaggedApi("com.android.internal.telephony.flags.enable_modem_cipher_transparency") @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setEnableNullCipherNotifications(boolean);
    method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.PinResult setIccLockEnabled(boolean, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMobileDataPolicyEnabled(int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean);
+56 −0
Original line number Diff line number Diff line
@@ -18124,6 +18124,62 @@ public class TelephonyManager {
        return false;
    }
    /**
     * Enables or disables notifications sent when cellular null cipher or integrity algorithms
     * are in use by the cellular modem.
     *
     * @throws IllegalStateException if the Telephony process is not currently available
     * @throws SecurityException if the caller does not have the required privileges
     * @throws UnsupportedOperationException if the modem does not support reporting on ciphering
     * and integrity algorithms in use
     * @hide
     */
    @FlaggedApi(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY)
    @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
    @SystemApi
    public void setEnableNullCipherNotifications(boolean enable) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                telephony.setEnableNullCipherNotifications(enable);
            } else {
                throw new IllegalStateException("telephony service is null.");
            }
        } catch (RemoteException ex) {
            Rlog.e(TAG, "setEnableNullCipherNotifications RemoteException", ex);
            ex.rethrowFromSystemServer();
        }
    }
    /**
     * Get whether notifications are enabled for null cipher or integrity algorithms in use by the
     * cellular modem.
     *
     * @throws IllegalStateException if the Telephony process is not currently available
     * @throws SecurityException if the caller does not have the required privileges
     * @throws UnsupportedOperationException if the modem does not support reporting on ciphering
     * and integrity algorithms in use
     * @hide
     */
    @FlaggedApi(Flags.FLAG_ENABLE_MODEM_CIPHER_TRANSPARENCY)
    @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @SystemApi
    public boolean isNullCipherNotificationsEnabled() {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.isNullCipherNotificationsEnabled();
            } else {
                throw new IllegalStateException("telephony service is null.");
            }
        } catch (RemoteException ex) {
            Rlog.e(TAG, "isNullCipherNotificationsEnabled RemoteException", ex);
            ex.rethrowFromSystemServer();
        }
        return false;
    }
    /**
     * Get current cell broadcast message identifier ranges.
     *
+28 −0
Original line number Diff line number Diff line
@@ -3207,4 +3207,32 @@ interface ITelephony {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
        + "android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)")
    boolean isCellularIdentifierDisclosureNotificationsEnabled();

    /**
     * Enables or disables notifications sent when cellular null cipher or integrity algorithms
     * are in use by the cellular modem.
     *
     * @throws IllegalStateException if the Telephony process is not currently available
     * @throws SecurityException if the caller does not have the required privileges
     * @throws UnsupportedOperationException if the modem does not support reporting on ciphering
     * and integrity algorithms in use
     * @hide
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
        + "android.Manifest.permission.MODIFY_PHONE_STATE)")
    void setEnableNullCipherNotifications(boolean enable);

    /**
     * Get whether notifications are enabled for null cipher or integrity algorithms in use by the
     * cellular modem.
     *
     * @throws IllegalStateException if the Telephony process is not currently available
     * @throws SecurityException if the caller does not have the required privileges
     * @throws UnsupportedOperationException if the modem does not support reporting on ciphering
     * and integrity algorithms in use
     * @hide
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
        + "android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)")
    boolean isNullCipherNotificationsEnabled();
}