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

Commit 92cae130 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Clean up CommunalManagerService"

parents 49ecf859 b292ef19
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -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";
+0 −9
Original line number Diff line number Diff line
@@ -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 {
+0 −17
Original line number Diff line number Diff line
@@ -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
+0 −62
Original line number Diff line number Diff line
/*
 * 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();
        }
    }
}
+0 −27
Original line number Diff line number Diff line
/*
 * 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
Loading