summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2017-12-06 15:58:46 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-12-06 15:58:46 +0000
commit2e24967956fcedc2d25eb4069c89fa7629d4b35f (patch)
tree53b054e896897f30136dd6bd93a2841fea8ead56
parentb85ca745aead2b4610d0681b3100312f8ad793e8 (diff)
parent8f5f7ff5faa46d4daca3d99f591567a21c591079 (diff)
Merge "Add system service for slices"
-rw-r--r--Android.bp1
-rw-r--r--Android.mk1
-rw-r--r--core/java/android/app/SystemServiceRegistry.java11
-rw-r--r--core/java/android/app/slice/ISliceManager.aidl21
-rw-r--r--core/java/android/app/slice/SliceManager.java39
-rw-r--r--core/java/android/content/Context.java8
-rw-r--r--services/core/java/com/android/server/slice/SliceManagerService.java61
-rw-r--r--services/java/com/android/server/SystemServer.java10
8 files changed, 152 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
index 487bf7a22e21..70b1fa0e793f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -98,6 +98,7 @@ java_library {
"core/java/android/app/backup/IRestoreObserver.aidl",
"core/java/android/app/backup/IRestoreSession.aidl",
"core/java/android/app/backup/ISelectBackupTransportCallback.aidl",
+ "core/java/android/app/slice/ISliceManager.aidl",
"core/java/android/app/timezone/ICallback.aidl",
"core/java/android/app/timezone/IRulesManager.aidl",
"core/java/android/app/usage/ICacheQuotaService.aidl",
diff --git a/Android.mk b/Android.mk
index ce504a5abdd3..d4d2baa81c55 100644
--- a/Android.mk
+++ b/Android.mk
@@ -95,6 +95,7 @@ aidl_files := \
frameworks/base/core/java/android/app/admin/NetworkEvent.aidl \
frameworks/base/core/java/android/app/admin/SystemUpdatePolicy.aidl \
frameworks/base/core/java/android/app/admin/PasswordMetrics.aidl \
+ frameworks/base/core/java/android/app/slice/ISliceManager.aidl \
frameworks/base/core/java/android/print/PrintDocumentInfo.aidl \
frameworks/base/core/java/android/print/PageRange.aidl \
frameworks/base/core/java/android/print/PrintAttributes.aidl \
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index e48946f2c3e4..f831ae220703 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -22,6 +22,7 @@ import android.app.admin.DevicePolicyManager;
import android.app.admin.IDevicePolicyManager;
import android.app.job.IJobScheduler;
import android.app.job.JobScheduler;
+import android.app.slice.SliceManager;
import android.app.timezone.RulesManager;
import android.app.trust.TrustManager;
import android.app.usage.IStorageStatsManager;
@@ -944,6 +945,16 @@ final class SystemServiceRegistry {
ICrossProfileApps.Stub.asInterface(b));
}
});
+
+ registerService(Context.SLICE_SERVICE, SliceManager.class,
+ new CachedServiceFetcher<SliceManager>() {
+ @Override
+ public SliceManager createService(ContextImpl ctx)
+ throws ServiceNotFoundException {
+ return new SliceManager(ctx.getOuterContext(),
+ ctx.mMainThread.getHandler());
+ }
+ });
}
/**
diff --git a/core/java/android/app/slice/ISliceManager.aidl b/core/java/android/app/slice/ISliceManager.aidl
new file mode 100644
index 000000000000..6e52f385bcf7
--- /dev/null
+++ b/core/java/android/app/slice/ISliceManager.aidl
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2017, 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.slice;
+
+/** @hide */
+interface ISliceManager {
+}
diff --git a/core/java/android/app/slice/SliceManager.java b/core/java/android/app/slice/SliceManager.java
new file mode 100644
index 000000000000..e99f67632712
--- /dev/null
+++ b/core/java/android/app/slice/SliceManager.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 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.slice;
+
+import android.annotation.SystemService;
+import android.content.Context;
+import android.os.Handler;
+import android.os.ServiceManager;
+import android.os.ServiceManager.ServiceNotFoundException;
+
+/**
+ * @hide
+ */
+@SystemService(Context.SLICE_SERVICE)
+public class SliceManager {
+
+ private final ISliceManager mService;
+ private final Context mContext;
+
+ public SliceManager(Context context, Handler handler) throws ServiceNotFoundException {
+ mContext = context;
+ mService = ISliceManager.Stub.asInterface(
+ ServiceManager.getServiceOrThrow(Context.SLICE_SERVICE));
+ }
+}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 71998eeb14c7..ca8120895d34 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -3406,6 +3406,14 @@ public abstract class Context {
public static final String NETWORKMANAGEMENT_SERVICE = "network_management";
/**
+ * Use with {@link #getSystemService} to retrieve a
+ * {@link com.android.server.slice.SliceManagerService} for managing slices.
+ * @hide
+ * @see #getSystemService
+ */
+ public static final String SLICE_SERVICE = "slice";
+
+ /**
* Use with {@link #getSystemService} to retrieve a {@link
* android.app.usage.NetworkStatsManager} for querying network usage stats.
*
diff --git a/services/core/java/com/android/server/slice/SliceManagerService.java b/services/core/java/com/android/server/slice/SliceManagerService.java
new file mode 100644
index 000000000000..047e270f3fac
--- /dev/null
+++ b/services/core/java/com/android/server/slice/SliceManagerService.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 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 com.android.server.slice;
+
+import android.app.slice.ISliceManager;
+import android.content.Context;
+
+import com.android.server.SystemService;
+
+public class SliceManagerService extends ISliceManager.Stub {
+
+ public SliceManagerService(Context context) {
+
+ }
+
+ private void systemReady() {
+ }
+
+ private void onUnlockUser(int userHandle) {
+ }
+
+ public static class Lifecycle extends SystemService {
+ private SliceManagerService mService;
+
+ public Lifecycle(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void onStart() {
+ mService = new SliceManagerService(getContext());
+ publishBinderService(Context.SLICE_SERVICE, mService);
+ }
+
+ @Override
+ public void onBootPhase(int phase) {
+ if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
+ mService.systemReady();
+ }
+ }
+
+ @Override
+ public void onUnlockUser(int userHandle) {
+ mService.onUnlockUser(userHandle);
+ }
+ }
+}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 33f4e3487f76..4c994b94e71b 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -215,6 +215,9 @@ public final class SystemServer {
"com.android.server.timezone.RulesManagerService$Lifecycle";
private static final String IOT_SERVICE_CLASS =
"com.google.android.things.services.IoTSystemService";
+ private static final String SLICE_MANAGER_SERVICE_CLASS =
+ "com.android.server.slice.SliceManagerService$Lifecycle";
+
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
private static final String UNCRYPT_PACKAGE_FILE = "/cache/recovery/uncrypt_file";
@@ -730,6 +733,7 @@ public final class SystemServer {
boolean disableVrManager = SystemProperties.getBoolean("config.disable_vrmanager", false);
boolean disableCameraService = SystemProperties.getBoolean("config.disable_cameraservice",
false);
+ boolean disableSlices = SystemProperties.getBoolean("config.disable_slices", false);
boolean enableLeftyService = SystemProperties.getBoolean("config.enable_lefty", false);
boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");
@@ -1523,6 +1527,12 @@ public final class SystemServer {
}
}
+ if (!disableSlices) {
+ traceBeginAndSlog("StartSliceManagerService");
+ mSystemServiceManager.startService(SLICE_MANAGER_SERVICE_CLASS);
+ traceEnd();
+ }
+
if (!disableCameraService) {
traceBeginAndSlog("StartCameraServiceProxy");
mSystemServiceManager.startService(CameraServiceProxy.class);