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

Commit 858bfaf7 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add handover permission, fill in some missing API gaps.

Adding the ACCEPT_HANDOVER runtime permission which an app must have in
order to accept handovers (this is per design).

Adding missing onHandoverComplete method in the android.telecom.Connection
API (per design).

Finishing plumbing for android.telecom.Call#onHandoverComplete API.

Fix issue where the new handover API methods would never get called; the
legacy handover extra was being used in this case when it should not have
been.

Bug: 65415068
Test: Verified using new CTS tests
Change-Id: If1558f6a23911862c02ac5b18fb62d86911ed7e2
Merged-In: If1558f6a23911862c02ac5b18fb62d86911ed7e2
parent df984fae
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ package android {
  public static final class Manifest.permission {
    ctor public Manifest.permission();
    field public static final java.lang.String ACCEPT_HANDOVER = "android.permission.ACCEPT_HANDOVER";
    field public static final java.lang.String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES";
    field public static final java.lang.String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
    field public static final java.lang.String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
@@ -39332,6 +39333,7 @@ package android.telecom {
    method public void onCallEvent(java.lang.String, android.os.Bundle);
    method public void onDisconnect();
    method public void onExtrasChanged(android.os.Bundle);
    method public void onHandoverComplete();
    method public void onHold();
    method public void onPlayDtmfTone(char);
    method public void onPostDialContinue(boolean);
+19 −2
Original line number Diff line number Diff line
@@ -252,8 +252,10 @@ public class AppOpsManager {
    public static final int OP_INSTANT_APP_START_FOREGROUND = 68;
    /** @hide Answer incoming phone calls */
    public static final int OP_ANSWER_PHONE_CALLS = 69;
    /** @hide Continue handover of a call from another app */
    public static final int OP_ACCEPT_HANDOVER = 70;
    /** @hide */
    public static final int _NUM_OP = 70;
    public static final int _NUM_OP = 71;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -365,6 +367,12 @@ public class AppOpsManager {
    /** Answer incoming phone calls */
    public static final String OPSTR_ANSWER_PHONE_CALLS
            = "android:answer_phone_calls";
    /***
     * Accept call handover
     * @hide
     */
    public static final String OPSTR_ACCEPT_HANDOVER
            = "android:accept_handover";

    // Warning: If an permission is added here it also has to be added to
    // com.android.packageinstaller.permission.utils.EventLogger
@@ -400,6 +408,7 @@ public class AppOpsManager {
            OP_USE_SIP,
            OP_PROCESS_OUTGOING_CALLS,
            OP_ANSWER_PHONE_CALLS,
            OP_ACCEPT_HANDOVER,
            // Microphone
            OP_RECORD_AUDIO,
            // Camera
@@ -492,7 +501,8 @@ public class AppOpsManager {
            OP_REQUEST_INSTALL_PACKAGES,
            OP_PICTURE_IN_PICTURE,
            OP_INSTANT_APP_START_FOREGROUND,
            OP_ANSWER_PHONE_CALLS
            OP_ANSWER_PHONE_CALLS,
            OP_ACCEPT_HANDOVER
    };

    /**
@@ -570,6 +580,7 @@ public class AppOpsManager {
            OPSTR_PICTURE_IN_PICTURE,
            OPSTR_INSTANT_APP_START_FOREGROUND,
            OPSTR_ANSWER_PHONE_CALLS,
            OPSTR_ACCEPT_HANDOVER
    };

    /**
@@ -647,6 +658,7 @@ public class AppOpsManager {
            "PICTURE_IN_PICTURE",
            "INSTANT_APP_START_FOREGROUND",
            "ANSWER_PHONE_CALLS",
            "ACCEPT_HANDOVER"
    };

    /**
@@ -724,6 +736,7 @@ public class AppOpsManager {
            null, // no permission for entering picture-in-picture on hide
            Manifest.permission.INSTANT_APP_FOREGROUND_SERVICE,
            Manifest.permission.ANSWER_PHONE_CALLS,
            Manifest.permission.ACCEPT_HANDOVER
    };

    /**
@@ -802,6 +815,7 @@ public class AppOpsManager {
            null, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
            null, // INSTANT_APP_START_FOREGROUND
            null, // ANSWER_PHONE_CALLS
            null, // ACCEPT_HANDOVER
    };

    /**
@@ -879,6 +893,7 @@ public class AppOpsManager {
            false, // ENTER_PICTURE_IN_PICTURE_ON_HIDE
            false, // INSTANT_APP_START_FOREGROUND
            false, // ANSWER_PHONE_CALLS
            false, // ACCEPT_HANDOVER
    };

    /**
@@ -955,6 +970,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED,  // OP_PICTURE_IN_PICTURE
            AppOpsManager.MODE_DEFAULT,  // OP_INSTANT_APP_START_FOREGROUND
            AppOpsManager.MODE_ALLOWED, // ANSWER_PHONE_CALLS
            AppOpsManager.MODE_ALLOWED, // ACCEPT_HANDOVER
    };

    /**
@@ -1035,6 +1051,7 @@ public class AppOpsManager {
            false, // OP_PICTURE_IN_PICTURE
            false,
            false, // ANSWER_PHONE_CALLS
            false, // ACCEPT_HANDOVER
    };

    /**
+17 −0
Original line number Diff line number Diff line
@@ -950,6 +950,23 @@
                android:description="@string/permdesc_manageOwnCalls"
                android:protectionLevel="normal" />

    <!-- Allows a calling app to continue a call which was started in another app.  An example is a
         video calling app that wants to continue a voice call on the user's mobile network.<p>
         When the handover of a call from one app to another takes place, there are two devices
         which are involved in the handover; the initiating and receiving devices.  The initiating
         device is where the request to handover the call was started, and the receiving device is
         where the handover request is confirmed by the other party.<p>
         This permission protects access to
         {@link android.telecom.TelecomManager#acceptHandover(Uri, int, PhoneAccountHandle)}, which
         the receiving side of the handover uses to accept a handover.
         <p>Protection level: dangerous
    -->
    <permission android:name="android.permission.ACCEPT_HANDOVER"
                android:permissionGroup="android.permission-group.PHONE"
                android.label="@string/permlab_acceptHandover"
                android:description="@string/permdesc_acceptHandover"
                android:protectionLevel="dangerous" />

    <!-- ====================================================================== -->
    <!-- Permissions for accessing the device microphone                        -->
    <!-- ====================================================================== -->
+11 −0
Original line number Diff line number Diff line
@@ -1076,6 +1076,17 @@
    <string name="permdesc_manageOwnCalls">Allows the app to route its calls through the system in
        order to improve the calling experience.</string>

    <!-- Title of an application permission.  When granted to a third party app, the user is giving
         access to the app to continue a call which originated in another app.  For example, the
         user could be in a voice call over their carrier's mobile network, and a third party video
         calling app wants to continue that voice call as a video call. -->
    <string name="permlab_acceptHandover">continue a call from another app</string>
    <!-- Description of an application permission.  When granted to a third party app, the user is
         giving access to the app to continue a call which originated in another app.  For example,
         the user could be in a voice call over their carrier's mobile network, and a third party
         video calling app wants to continue that voice call as a video call. -->
    <string name="permdesc_acceptHandover">Allows the app to continue a call which was started in another app.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_readPhoneNumbers">read phone numbers</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+2 −1
Original line number Diff line number Diff line
@@ -610,7 +610,8 @@ public class PackageManagerService extends IPackageManager.Stub
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.WRITE_EXTERNAL_STORAGE,
            Manifest.permission.READ_PHONE_NUMBERS,
            Manifest.permission.ANSWER_PHONE_CALLS);
            Manifest.permission.ANSWER_PHONE_CALLS,
            Manifest.permission.ACCEPT_HANDOVER);
    /**
Loading