diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index dd951b4e71d36..d8cb961c1b378 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -1309,6 +1309,14 @@ package android.app.backup {
}
+package android.app.communal {
+
+ public final class CommunalManager {
+ method @RequiresPermission("android.permission.READ_COMMUNAL_STATE") public boolean isCommunalMode();
+ }
+
+}
+
package android.app.compat {
public final class CompatChanges {
diff --git a/core/java/android/app/communal/CommunalManager.java b/core/java/android/app/communal/CommunalManager.java
index 60730adb43075..c2d2f271a8fbe 100644
--- a/core/java/android/app/communal/CommunalManager.java
+++ b/core/java/android/app/communal/CommunalManager.java
@@ -19,6 +19,7 @@ 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.compat.annotation.ChangeId;
import android.compat.annotation.Disabled;
@@ -33,6 +34,7 @@ import android.os.RemoteException;
*
* @hide
*/
+@SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
@SystemService(Context.COMMUNAL_MANAGER_SERVICE)
@RequiresFeature(PackageManager.FEATURE_COMMUNAL_MODE)
public final class CommunalManager {
@@ -59,6 +61,7 @@ public final class CommunalManager {
@Disabled
public static final long ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT = 200324021L;
+ /** @hide */
public CommunalManager(ICommunalManager service) {
mService = service;
}
@@ -67,6 +70,8 @@ public final class CommunalManager {
* Updates whether or not the communal view is currently showing over the lockscreen.
*
* @param isShowing Whether communal view is showing.
+ *
+ * @hide
*/
@RequiresPermission(Manifest.permission.WRITE_COMMUNAL_STATE)
public void setCommunalViewShowing(boolean isShowing) {
@@ -76,4 +81,16 @@ public final class CommunalManager {
throw e.rethrowFromSystemServer();
}
}
+
+ /**
+ * Check whether or not the communal view is currently showing over the lockscreen.
+ */
+ @RequiresPermission(Manifest.permission.READ_COMMUNAL_STATE)
+ public boolean isCommunalMode() {
+ try {
+ return mService.isCommunalMode();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
}
diff --git a/core/java/android/app/communal/ICommunalManager.aidl b/core/java/android/app/communal/ICommunalManager.aidl
index 02e8a65707102..123b23c4b5536 100644
--- a/core/java/android/app/communal/ICommunalManager.aidl
+++ b/core/java/android/app/communal/ICommunalManager.aidl
@@ -22,6 +22,7 @@ package android.app.communal;
*
* @hide
*/
-oneway interface ICommunalManager {
- void setCommunalViewShowing(boolean isShowing);
+interface ICommunalManager {
+ oneway void setCommunalViewShowing(boolean isShowing);
+ boolean isCommunalMode();
}
\ No newline at end of file
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 6e2c807105168..07cff73a841a1 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -5535,6 +5535,12 @@
+
+
+