diff options
author | Tyler Gunn <tgunn@google.com> | 2016-11-09 10:19:23 -0800 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2017-02-06 14:49:03 -0800 |
commit | bf9c6fdb43413929787ee3abeb76e5aabd1551d8 (patch) | |
tree | f0d48d87d495158bed81ca22c9b43eca58c4e63b /telecomm/java/android/telecom/InCallService.java | |
parent | ed839943e08c956ddd3fb74941e45bbb59343c8c (diff) |
Perform camera permission and app ops check when setting camera for VT.
When a calling InCallService attempts to use the setCamera API on the
VideoCall, Telecom will perform a permission check to ensure that the
caller has the correct camera permission and passes the app-ops camera
check. A failure to set the camera will result in a callback via the
call session event API.
This got a little messy as the app ops package name needs to come from the
InCallService, and handler usage in the VideoProvider API means we had to
pass around the uid/pid of the caller, obtained before we trampoline onto
the handler.
Test: Unit tests added, manual testing performed.
Bug: 32747443
Change-Id: I555a04f9c3fb45e60bb811f64ba855ccf2e3b0e2
Diffstat (limited to 'telecomm/java/android/telecom/InCallService.java')
-rw-r--r-- | telecomm/java/android/telecom/InCallService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 69de89d5ed74..5d68aaeda988 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -87,7 +87,8 @@ public abstract class InCallService extends Service { switch (msg.what) { case MSG_SET_IN_CALL_ADAPTER: - mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj)); + String callingPackage = getApplicationContext().getOpPackageName(); + mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj), callingPackage); mPhone.addListener(mPhoneListener); onPhoneCreated(mPhone); break; @@ -664,7 +665,8 @@ public abstract class InCallService extends Service { * {@link Connection.VideoProvider#SESSION_EVENT_TX_START}, * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP}, * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE}, - * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}. + * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}, + * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_PERMISSION_ERROR}. */ public abstract void onCallSessionEvent(int event); |