Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / library / aosp-stubs / src / main / java / android / app / supervision / SupervisionAppService.java

SupervisionAppService.java39 lines · 1.6 KiBRaw
1package android.app.supervision;
2
3import android.app.Service;
4import android.content.Intent;
5import android.os.IBinder;
6
7/**
8 * Stub of the framework's {@code @SystemApi android.app.supervision.SupervisionAppService}.
9 *
10 * <p>Upstream doc: a service the holders of {@code ROLE_SYSTEM_SUPERVISION} or
11 * {@code ROLE_SUPERVISION} <em>must</em> extend. The system searches each role holder for
12 * {@link #ACTION_SUPERVISION_APP_SERVICE} and keeps a bound connection to it in the foreground,
13 * rebinding after a backoff if the process dies.
14 *
15 * <p>{@code onBind} is <b>final</b> upstream - it returns an {@code ISupervisionListener.Stub}
16 * that dispatches to the callbacks below. It is final here for that reason: were the stub to
17 * leave it open, a subclass could override it, which compiles cleanly and fails on device with
18 * {@code IncompatibleClassChangeError}. Override {@code onServiceBound} if you need the intent.
19 */
20public class SupervisionAppService extends Service {
21
22 /** Inlined by javac. Must match what {@code SupervisionAppServiceFinder} queries for. */
23 public static final String ACTION_SUPERVISION_APP_SERVICE =
24 "android.app.action.SUPERVISION_APP_SERVICE";
25
26 @Override
27 public final IBinder onBind(Intent intent) {
28 throw new UnsupportedOperationException("stub");
29 }
30
31 /** Called when the service is bound. Exists because {@link #onBind} is final. */
32 public void onServiceBound(Intent intent) {}
33
34 public void onSupervisionEnabled() {}
35
36 public void onSupervisionDisabled() {}
37
38 public void onPolicyChanged(Policy policy) {}
39}