diff options
17 files changed, 1 insertions, 405 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 800c8ab01c2f..5084b40ee4f5 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1423,13 +1423,6 @@ package android.app.backup { } -package android.app.communal { - - public final class CommunalManager { - } - -} - package android.app.compat { public final class CompatChanges { @@ -2646,7 +2639,6 @@ package android.content { field public static final String BATTERY_STATS_SERVICE = "batterystats"; field @Deprecated public static final int BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS = 1048576; // 0x100000 field public static final int BIND_ALLOW_FOREGROUND_SERVICE_STARTS_FROM_BACKGROUND = 262144; // 0x40000 - field public static final String COMMUNAL_SERVICE = "communal"; field public static final String CONTENT_SUGGESTIONS_SERVICE = "content_suggestions"; field public static final String CONTEXTHUB_SERVICE = "contexthub"; field public static final String ETHERNET_SERVICE = "ethernet"; diff --git a/core/api/test-current.txt b/core/api/test-current.txt index f1b46248ef85..d6a9f7faea65 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -43,7 +43,6 @@ package android { field public static final String TEST_BIOMETRIC = "android.permission.TEST_BIOMETRIC"; field public static final String TEST_MANAGE_ROLLBACKS = "android.permission.TEST_MANAGE_ROLLBACKS"; field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS"; - field public static final String WRITE_COMMUNAL_STATE = "android.permission.WRITE_COMMUNAL_STATE"; field public static final String WRITE_DEVICE_CONFIG = "android.permission.WRITE_DEVICE_CONFIG"; field @Deprecated public static final String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE"; field public static final String WRITE_OBB = "android.permission.WRITE_OBB"; @@ -557,14 +556,6 @@ package android.app.blob { } -package android.app.communal { - - public final class CommunalManager { - method @RequiresPermission(android.Manifest.permission.WRITE_COMMUNAL_STATE) public void setCommunalViewShowing(boolean); - } - -} - package android.app.contentsuggestions { public final class ContentSuggestionsManager { diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 85ddff9a9311..8bc29496c87a 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -26,8 +26,6 @@ import android.app.admin.DevicePolicyManager; import android.app.admin.IDevicePolicyManager; import android.app.appsearch.AppSearchManagerFrameworkInitializer; import android.app.blob.BlobStoreManagerFrameworkInitializer; -import android.app.communal.CommunalManager; -import android.app.communal.ICommunalManager; import android.app.contentsuggestions.ContentSuggestionsManager; import android.app.contentsuggestions.IContentSuggestionsManager; import android.app.job.JobSchedulerFrameworkInitializer; @@ -1519,21 +1517,6 @@ public final class SystemServiceRegistry { } }); - registerService(Context.COMMUNAL_SERVICE, CommunalManager.class, - new CachedServiceFetcher<CommunalManager>() { - @Override - public CommunalManager createService(ContextImpl ctx) { - if (!ctx.getPackageManager().hasSystemFeature( - PackageManager.FEATURE_COMMUNAL_MODE)) { - return null; - } - IBinder iBinder = - ServiceManager.getService(Context.COMMUNAL_SERVICE); - return iBinder != null ? new CommunalManager( - ICommunalManager.Stub.asInterface(iBinder)) : null; - } - }); - sInitializing = true; try { // Note: the following functions need to be @SystemApis, once they become mainline diff --git a/core/java/android/app/communal/CommunalManager.java b/core/java/android/app/communal/CommunalManager.java deleted file mode 100644 index c7368ade2dcc..000000000000 --- a/core/java/android/app/communal/CommunalManager.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.app.communal; - -import android.Manifest; -import android.annotation.RequiresFeature; -import android.annotation.RequiresPermission; -import android.annotation.SystemApi; -import android.annotation.SystemService; -import android.annotation.TestApi; -import android.content.Context; -import android.content.pm.PackageManager; -import android.os.RemoteException; - -/** - * System private class for talking with the - * {@link com.android.server.communal.CommunalManagerService} that handles communal mode state. - * - * @hide - */ -@SystemApi(client = SystemApi.Client.PRIVILEGED_APPS) -@SystemService(Context.COMMUNAL_SERVICE) -@RequiresFeature(PackageManager.FEATURE_COMMUNAL_MODE) -public final class CommunalManager { - private final ICommunalManager mService; - - /** @hide */ - public CommunalManager(ICommunalManager service) { - mService = service; - } - - /** - * Updates whether or not the communal view is currently showing over the lockscreen. - * - * @param isShowing Whether communal view is showing. - * - * @hide - */ - @TestApi - @RequiresPermission(Manifest.permission.WRITE_COMMUNAL_STATE) - public void setCommunalViewShowing(boolean isShowing) { - try { - mService.setCommunalViewShowing(isShowing); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } -} diff --git a/core/java/android/app/communal/ICommunalManager.aidl b/core/java/android/app/communal/ICommunalManager.aidl deleted file mode 100644 index df9d7cec05f7..000000000000 --- a/core/java/android/app/communal/ICommunalManager.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.app.communal; - -/** - * System private API for talking with the communal manager service that handles communal mode - * state. - * - * @hide - */ -interface ICommunalManager { - oneway void setCommunalViewShowing(boolean isShowing); -}
\ No newline at end of file diff --git a/core/java/android/app/communal/OWNERS b/core/java/android/app/communal/OWNERS deleted file mode 100644 index b02883da854a..000000000000 --- a/core/java/android/app/communal/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -brycelee@google.com -justinkoh@google.com -lusilva@google.com -xilei@google.com
\ No newline at end of file diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 0f24de6c54cb..2309fb636d44 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -5895,17 +5895,6 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve a - * {@link android.app.communal.CommunalManager} for interacting with the global system state. - * - * @see #getSystemService(String) - * @see android.app.communal.CommunalManager - * @hide - */ - @SystemApi - public static final String COMMUNAL_SERVICE = "communal"; - - /** - * Use with {@link #getSystemService(String)} to retrieve a * {@link android.app.LocaleManager}. * * @see #getSystemService(String) diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index d0b9f880591d..a95cccfba750 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -5603,13 +5603,6 @@ <permission android:name="android.permission.VIEW_INSTANT_APPS" android:protectionLevel="signature|preinstalled" /> - <!-- Allows an application to interact with the currently active - {@link com.android.server.communal.CommunalManagerService}. - @hide - @TestApi --> - <permission android:name="android.permission.WRITE_COMMUNAL_STATE" - android:protectionLevel="signature" /> - <!-- Allows the holder to manage whether the system can bind to services provided by instant apps. This permission is intended to protect test/development fucntionality and should be used only in such cases. diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index e9e85f156d6d..92ae92e99747 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -150,9 +150,6 @@ <uses-permission android:name="android.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS" /> <uses-permission android:name="android.permission.GET_RUNTIME_PERMISSIONS" /> - <!-- Communal mode --> - <uses-permission android:name="android.permission.WRITE_COMMUNAL_STATE" /> - <!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked --> <uses-permission android:name="android.permission.SET_WALLPAPER"/> diff --git a/packages/SystemUI/src/com/android/systemui/communal/CommunalManagerUpdater.java b/packages/SystemUI/src/com/android/systemui/communal/CommunalManagerUpdater.java deleted file mode 100644 index ebe804af15e8..000000000000 --- a/packages/SystemUI/src/com/android/systemui/communal/CommunalManagerUpdater.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.communal; - -import android.app.communal.CommunalManager; -import android.content.Context; -import android.util.Log; - -import com.android.systemui.CoreStartable; -import com.android.systemui.dagger.SysUISingleton; - -import java.lang.ref.WeakReference; - -import javax.inject.Inject; - -/** - * The {@link CommunalManagerUpdater} is responsible for forwarding state from SystemUI to - * the {@link CommunalManager} system service. - */ -@SysUISingleton -public class CommunalManagerUpdater extends CoreStartable { - private static final String TAG = "CommunalManagerUpdater"; - - private final CommunalManager mCommunalManager; - private final CommunalSourceMonitor mMonitor; - - private final CommunalSourceMonitor.Callback mSourceCallback = - new CommunalSourceMonitor.Callback() { - @Override - public void onSourceAvailable(WeakReference<CommunalSource> source) { - try { - mCommunalManager.setCommunalViewShowing( - source != null && source.get() != null); - } catch (RuntimeException e) { - Log.e(TAG, "Error updating communal manager service state", e); - } - } - }; - - @Inject - public CommunalManagerUpdater(Context context, CommunalSourceMonitor monitor) { - super(context); - mCommunalManager = context.getSystemService(CommunalManager.class); - mMonitor = monitor; - } - - @Override - public void start() { - if (mCommunalManager != null) { - mMonitor.addCallback(mSourceCallback); - } - } -} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java index 00491da38280..154f6fad5998 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java @@ -25,7 +25,6 @@ import com.android.systemui.accessibility.SystemActions; import com.android.systemui.accessibility.WindowMagnification; import com.android.systemui.biometrics.AuthController; import com.android.systemui.clipboardoverlay.ClipboardListener; -import com.android.systemui.communal.CommunalManagerUpdater; import com.android.systemui.dreams.DreamOverlayRegistrant; import com.android.systemui.dreams.appwidgets.ComplicationPrimer; import com.android.systemui.globalactions.GlobalActionsComponent; @@ -220,11 +219,4 @@ public abstract class SystemUIBinder { @ClassKey(ComplicationPrimer.class) public abstract CoreStartable bindAppWidgetOverlayPrimer( ComplicationPrimer complicationPrimer); - - /** Inject into CommunalManagerUpdater. */ - @Binds - @IntoMap - @ClassKey(CommunalManagerUpdater.class) - public abstract CoreStartable bindCommunalManagerUpdater( - CommunalManagerUpdater communalManagerUpdater); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/communal/CommunalManagerUpdaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/communal/CommunalManagerUpdaterTest.java deleted file mode 100644 index 4a29ada8a998..000000000000 --- a/packages/SystemUI/tests/src/com/android/systemui/communal/CommunalManagerUpdaterTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.communal; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.clearInvocations; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import android.app.communal.CommunalManager; -import android.testing.AndroidTestingRunner; - -import androidx.test.filters.SmallTest; - -import com.android.systemui.SysuiTestCase; -import com.android.systemui.util.concurrency.FakeExecutor; -import com.android.systemui.util.condition.Monitor; -import com.android.systemui.util.time.FakeSystemClock; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -@SmallTest -@RunWith(AndroidTestingRunner.class) -public class CommunalManagerUpdaterTest extends SysuiTestCase { - private CommunalSourceMonitor mMonitor; - @Mock - private CommunalManager mCommunalManager; - @Mock - private Monitor mCommunalConditionsMonitor; - - private FakeExecutor mExecutor = new FakeExecutor(new FakeSystemClock()); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - mContext.addMockSystemService(CommunalManager.class, mCommunalManager); - - doAnswer(invocation -> { - final Monitor.Callback callback = invocation.getArgument(0); - callback.onConditionsChanged(true); - return null; - }).when(mCommunalConditionsMonitor).addCallback(any()); - - mMonitor = new CommunalSourceMonitor(mExecutor, mCommunalConditionsMonitor); - final CommunalManagerUpdater updater = new CommunalManagerUpdater(mContext, mMonitor); - updater.start(); - clearInvocations(mCommunalManager); - } - - @Test - public void testUpdateSystemService_false() { - mMonitor.setSource(null); - mExecutor.runAllReady(); - verify(mCommunalManager).setCommunalViewShowing(false); - } - - @Test - public void testUpdateSystemService_true() { - final CommunalSource source = mock(CommunalSource.class); - mMonitor.setSource(source); - mExecutor.runAllReady(); - verify(mCommunalManager).setCommunalViewShowing(true); - } -} diff --git a/services/core/java/com/android/server/communal/CommunalManagerService.java b/services/core/java/com/android/server/communal/CommunalManagerService.java deleted file mode 100644 index 600313bbad64..000000000000 --- a/services/core/java/com/android/server/communal/CommunalManagerService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.communal; - -import android.Manifest; -import android.annotation.RequiresPermission; -import android.app.communal.ICommunalManager; -import android.content.Context; - -import com.android.internal.annotations.VisibleForTesting; -import com.android.server.SystemService; - -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * System service for handling Communal Mode state. - */ -public final class CommunalManagerService extends SystemService { - private final Context mContext; - private final AtomicBoolean mCommunalViewIsShowing = new AtomicBoolean(false); - private final BinderService mBinderService; - - public CommunalManagerService(Context context) { - super(context); - mContext = context; - mBinderService = new BinderService(); - } - - @VisibleForTesting - BinderService getBinderServiceInstance() { - return mBinderService; - } - - @Override - public void onStart() { - publishBinderService(Context.COMMUNAL_SERVICE, mBinderService); - } - - private final class BinderService extends ICommunalManager.Stub { - /** - * Sets whether or not we are in communal mode. - */ - @RequiresPermission(Manifest.permission.WRITE_COMMUNAL_STATE) - @Override - public void setCommunalViewShowing(boolean isShowing) { - mContext.enforceCallingPermission(Manifest.permission.WRITE_COMMUNAL_STATE, - Manifest.permission.WRITE_COMMUNAL_STATE - + "permission required to modify communal state."); - if (mCommunalViewIsShowing.get() == isShowing) { - return; - } - mCommunalViewIsShowing.set(isShowing); - } - } -} diff --git a/services/core/java/com/android/server/communal/OWNERS b/services/core/java/com/android/server/communal/OWNERS deleted file mode 100644 index b02883da854a..000000000000 --- a/services/core/java/com/android/server/communal/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -brycelee@google.com -justinkoh@google.com -lusilva@google.com -xilei@google.com
\ No newline at end of file diff --git a/services/core/java/com/android/server/communal/TEST_MAPPING b/services/core/java/com/android/server/communal/TEST_MAPPING deleted file mode 100644 index 026e9bb91aee..000000000000 --- a/services/core/java/com/android/server/communal/TEST_MAPPING +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presubmit": [ - { - "name": "FrameworksMockingServicesTests", - "options": [ - { - "include-filter": "com.android.server.communal" - } - ] - } - ] -}
\ No newline at end of file diff --git a/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java b/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java index 48dd2f4238c6..4df2e1782e4f 100644 --- a/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java +++ b/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java @@ -53,7 +53,6 @@ public abstract class ActivityInterceptorCallback { */ @IntDef(suffix = { "_ORDERED_ID" }, value = { FIRST_ORDERED_ID, - COMMUNAL_MODE_ORDERED_ID, PERMISSION_POLICY_ORDERED_ID, VIRTUAL_DEVICE_SERVICE_ORDERED_ID, LAST_ORDERED_ID // Update this when adding new ids @@ -67,14 +66,9 @@ public abstract class ActivityInterceptorCallback { static final int FIRST_ORDERED_ID = 0; /** - * The identifier for {@link com.android.server.communal.CommunalManagerService} interceptor. - */ - public static final int COMMUNAL_MODE_ORDERED_ID = 1; - - /** * The identifier for {@link com.android.server.policy.PermissionPolicyService} interceptor */ - public static final int PERMISSION_POLICY_ORDERED_ID = 2; + public static final int PERMISSION_POLICY_ORDERED_ID = 1; /** * The identifier for {@link com.android.server.companion.virtual.VirtualDeviceManagerService} diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index c767f4d72e47..4b21454bdc00 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -115,7 +115,6 @@ import com.android.server.biometrics.sensors.iris.IrisService; import com.android.server.broadcastradio.BroadcastRadioService; import com.android.server.camera.CameraServiceProxy; import com.android.server.clipboard.ClipboardService; -import com.android.server.communal.CommunalManagerService; import com.android.server.compat.PlatformCompat; import com.android.server.compat.PlatformCompatNative; import com.android.server.connectivity.PacProxyService; @@ -2747,12 +2746,6 @@ public final class SystemServer implements Dumpable { mSystemServiceManager.startService(APP_COMPAT_OVERRIDES_SERVICE_CLASS); t.traceEnd(); - if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_COMMUNAL_MODE)) { - t.traceBegin("CommunalManagerService"); - mSystemServiceManager.startService(CommunalManagerService.class); - t.traceEnd(); - } - // These are needed to propagate to the runnable below. final NetworkManagementService networkManagementF = networkManagement; final NetworkStatsService networkStatsF = networkStats; |