summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInsun Kang <insun@google.com>2019-01-16 17:21:05 +0900
committerInsun Kang <insun@google.com>2019-01-17 19:32:12 +0900
commitb3517bf1fef51612f5b2b4537baae71e67342707 (patch)
treefcd3914df13119959ee2c0b278850d45e649ad30
parent0b9b1d420a6aed3284c0cd6e78d5f147e62f2c42 (diff)
Initial code for AML MediaSessionService
Bug: 123000882 Test: build / manually Change-Id: If2234340ed835fa02dcdbd1fd1b968418fe0a8ac
-rw-r--r--media/Android.bp17
-rw-r--r--media/java/android/media/session/MediaSessionProviderService.java35
-rw-r--r--media/packages/MediaCore/Android.bp21
-rw-r--r--media/packages/MediaCore/AndroidManifest.xml32
-rw-r--r--media/packages/MediaCore/res/values/strings.xml21
-rw-r--r--media/packages/MediaCore/src/com/android/media/AmlMediaSessionProviderService.java37
6 files changed, 163 insertions, 0 deletions
diff --git a/media/Android.bp b/media/Android.bp
index d5da6f266952..8ebc91a06f7a 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -1,4 +1,21 @@
java_library {
+ name: "media1",
+
+ srcs: [
+ ":media1-srcs",
+ ],
+
+ sdk_version: "system_current",
+}
+
+filegroup {
+ name: "media1-srcs",
+ srcs: [
+ "java/android/media/session/MediaSessionProviderService.java",
+ ],
+}
+
+java_library {
// TODO: include media2.jar in the media apex and add it to the bootclasspath.
name: "media2",
diff --git a/media/java/android/media/session/MediaSessionProviderService.java b/media/java/android/media/session/MediaSessionProviderService.java
new file mode 100644
index 000000000000..9a346ff4a12e
--- /dev/null
+++ b/media/java/android/media/session/MediaSessionProviderService.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2019 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.media.session;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+/**
+ * Abstract class for mainline module services.
+ *
+ * @hide // TODO: Make it as a @SystemApi
+ */
+public abstract class MediaSessionProviderService extends Service {
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ // TODO: Return IMediaSessionProviderService.Stub()
+ return null;
+ }
+}
diff --git a/media/packages/MediaCore/Android.bp b/media/packages/MediaCore/Android.bp
new file mode 100644
index 000000000000..c7fd58bf933a
--- /dev/null
+++ b/media/packages/MediaCore/Android.bp
@@ -0,0 +1,21 @@
+android_app {
+ name: "MediaCore",
+
+ srcs: [
+ "src/**/*.java",
+ ],
+
+ static_libs: [
+ // TODO: Temporarily statically linked. Should go into "libs"
+ "media1",
+ ],
+
+ // System app
+ platform_apis: true,
+
+ // Privileged app
+ privileged: true,
+
+ // Make sure that the implementation only relies on SDK or system APIs.
+ sdk_version: "system_current",
+}
diff --git a/media/packages/MediaCore/AndroidManifest.xml b/media/packages/MediaCore/AndroidManifest.xml
new file mode 100644
index 000000000000..4e2b274511e8
--- /dev/null
+++ b/media/packages/MediaCore/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/AndroidManifest.xml
+**
+** Copyright 2019, 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.
+*/
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.media" coreApp="true" android:sharedUserId="android.uid.system"
+ android:sharedUserLabel="@string/android_system_label">
+ <application android:process="system"
+ android:persistent="true"
+ android:directBootAware="true">
+ <service android:name="AmlMediaSessionProviderService" android:singleUser="true">
+ <intent-filter>
+ <action android:name="android.media.session.MediaSessionProviderService"/>
+ </intent-filter>
+ </service>
+ </application>
+</manifest>
diff --git a/media/packages/MediaCore/res/values/strings.xml b/media/packages/MediaCore/res/values/strings.xml
new file mode 100644
index 000000000000..59fd635b905f
--- /dev/null
+++ b/media/packages/MediaCore/res/values/strings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 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.
+-->
+
+<resources>
+ <!-- Label for the Android system components when they are shown to the user. -->
+ <string name="android_system_label" translatable="false">Android System</string>
+</resources>
+
diff --git a/media/packages/MediaCore/src/com/android/media/AmlMediaSessionProviderService.java b/media/packages/MediaCore/src/com/android/media/AmlMediaSessionProviderService.java
new file mode 100644
index 000000000000..43b95ab7ebdb
--- /dev/null
+++ b/media/packages/MediaCore/src/com/android/media/AmlMediaSessionProviderService.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2019 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.media;
+
+import android.content.Context;
+import android.media.session.MediaSessionProviderService;
+import android.os.PowerManager;
+import android.util.Log;
+
+/**
+ * System implementation of MediaSessionProviderService
+ */
+public class AmlMediaSessionProviderService extends MediaSessionProviderService {
+ private static final String TAG = "AmlMediaSessionProviderS";
+ static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+
+ private Context mContext;
+
+ public AmlMediaSessionProviderService(Context context) {
+ mContext = context;
+ PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ }
+}