blob: f5d5e6e9a95055df9f7bc4c82b411a538ad224e2 [file] [log] [blame]
Dianne Hackbornd5254412018-05-11 18:02:58 -07001/*
2 * Copyright (C) 2018 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
17package android.app;
18
19import android.util.SparseIntArray;
20
Svet Ganovd873ae62018-06-25 16:39:23 -070021import com.android.internal.util.function.QuadFunction;
22import com.android.internal.util.function.TriFunction;
23
Dianne Hackbornd5254412018-05-11 18:02:58 -070024/**
25 * App ops service local interface.
26 *
27 * @hide Only for use within the system server.
28 */
29public abstract class AppOpsManagerInternal {
Svet Ganovd873ae62018-06-25 16:39:23 -070030 /** Interface to override app ops checks via composition */
31 public interface CheckOpsDelegate {
32 /**
33 * Allows overriding check operation behavior.
34 *
35 * @param code The op code to check.
36 * @param uid The UID for which to check.
37 * @param packageName The package for which to check.
38 * @param superImpl The super implementation.
39 * @return The app op check result.
40 */
41 int checkOperation(int code, int uid, String packageName,
42 TriFunction<Integer, Integer, String, Integer> superImpl);
43
44 /**
45 * Allows overriding check audio operation behavior.
46 *
47 * @param code The op code to check.
48 * @param usage The audio op usage.
49 * @param uid The UID for which to check.
50 * @param packageName The package for which to check.
51 * @param superImpl The super implementation.
52 * @return The app op check result.
53 */
54 int checkAudioOperation(int code, int usage, int uid, String packageName,
55 QuadFunction<Integer, Integer, Integer, String, Integer> superImpl);
56
57 /**
58 * Allows overriding note operation behavior.
59 *
60 * @param code The op code to note.
61 * @param uid The UID for which to note.
62 * @param packageName The package for which to note.
63 * @param superImpl The super implementation.
64 * @return The app op note result.
65 */
66 int noteOperation(int code, int uid, String packageName,
67 TriFunction<Integer, Integer, String, Integer> superImpl);
68 }
69
Dianne Hackbornd5254412018-05-11 18:02:58 -070070 /**
71 * Set the currently configured device and profile owners. Specifies the package uid (value)
72 * that has been configured for each user (key) that has one. These will be allowed privileged
73 * access to app ops for their user.
74 */
75 public abstract void setDeviceAndProfileOwners(SparseIntArray owners);
76}