From 2b62927d832b3329fba03d34fc336b68d6ab4dcf Mon Sep 17 00:00:00 2001 From: Alex Salo Date: Thu, 19 Mar 2020 14:05:08 -0700 Subject: [PATCH] Use explicit BOUND_FOREGROUND_SERVICE flag to bind Implicit capabilities had been removed, so now we need to explicitly use these flags to be able to access the camera2 apis. Bug: 151873755 Test: manually verified the screen attention works now Change-Id: I28445db92050f63e08b8455afb94c9fdda94320c --- .../android/server/attention/AttentionManagerService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java index d6367ef609a54..507f9c6b5abaf 100644 --- a/services/core/java/com/android/server/attention/AttentionManagerService.java +++ b/services/core/java/com/android/server/attention/AttentionManagerService.java @@ -16,6 +16,9 @@ package com.android.server.attention; +import static android.content.Context.BIND_AUTO_CREATE; +import static android.content.Context.BIND_FOREGROUND_SERVICE; +import static android.content.Context.BIND_INCLUDE_CAPABILITIES; import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE; import static android.service.attention.AttentionService.ATTENTION_FAILURE_CANCELLED; import static android.service.attention.AttentionService.ATTENTION_FAILURE_UNKNOWN; @@ -498,7 +501,6 @@ public class AttentionManagerService extends SystemService { } } - private class AttentionServiceConnection implements ServiceConnection { @Override public void onServiceConnected(ComponentName name, IBinder service) { @@ -642,7 +644,8 @@ public class AttentionManagerService extends SystemService { mComponentName); // Note: no reason to clear the calling identity, we won't have one in a handler. mContext.bindServiceAsUser(serviceIntent, mConnection, - Context.BIND_AUTO_CREATE, UserHandle.CURRENT); + BIND_AUTO_CREATE | BIND_FOREGROUND_SERVICE | BIND_INCLUDE_CAPABILITIES, + UserHandle.CURRENT); }); }