• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.am;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 
22 /**
23  * Interface for in-process calls into
24  * {@link android.content.Context#ACTIVITY_SERVICE ActivityManager system service}.
25  *
26  * @hide
27  */
28 @SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
29 public interface ActivityManagerLocal {
30     /**
31      * Checks whether an app will be able to start a foreground service or not.
32      *
33      * @param pid The process id belonging to the app to be checked.
34      * @param uid The UID of the app to be checked.
35      * @param packageName The package name of the app to be checked.
36      * @return whether the app will be able to start a foreground service or not.
37      */
canStartForegroundService(int pid, int uid, @NonNull String packageName)38     boolean canStartForegroundService(int pid, int uid, @NonNull String packageName);
39 
40     /**
41      * Returns {@code true} if a foreground service started by an uid is allowed to have
42      * while-in-use permissions.
43      *
44      * @param pid The process id belonging to the app to be checked.
45      * @param uid The UID of the app to be checked.
46      * @param packageName The package name of the app to be checked.
47      * @return whether the foreground service is allowed to have while-in-use permissions.
48      * @hide
49      */
canAllowWhileInUsePermissionInFgs(int pid, int uid, @NonNull String packageName)50     boolean canAllowWhileInUsePermissionInFgs(int pid, int uid, @NonNull String packageName);
51 
52     /**
53      * Temporarily allow foreground service started by an uid to have while-in-use permission
54      * for durationMs.
55      *
56      * @param uid The UID of the app that starts the foreground service.
57      * @param durationMs elapsedRealTime duration in milliseconds.
58      * @hide
59      */
tempAllowWhileInUsePermissionInFgs(int uid, long durationMs)60     void tempAllowWhileInUsePermissionInFgs(int uid, long durationMs);
61 }
62