Bug 1257777 - Part 1: AIDL interfaces for remote codec and manager service binders. r=snorp, r=nalexander draft
authorJohn Lin <jolin@mozilla.com>
Fri, 05 Aug 2016 15:28:04 +0800
changeset 401591 74893694ac5d323a5d323571f10df7c3c8ac2dbd
parent 401500 fe895421dfbe1f1f8f1fc6a39bb20774423a6d74
child 401592 4179317d52510ae4ca5be77678b3f39af9a7588b
push id26504
push userbmo:jolin@mozilla.com
push dateWed, 17 Aug 2016 06:44:30 +0000
reviewerssnorp, nalexander
bugs1257777
milestone51.0a1
Bug 1257777 - Part 1: AIDL interfaces for remote codec and manager service binders. r=snorp, r=nalexander MozReview-Commit-ID: DAaJyWcyC0c
mobile/android/app/build.gradle
mobile/android/base/Makefile.in
mobile/android/base/aidl/org/mozilla/gecko/media/FormatParam.aidl
mobile/android/base/aidl/org/mozilla/gecko/media/ICodec.aidl
mobile/android/base/aidl/org/mozilla/gecko/media/ICodecCallbacks.aidl
mobile/android/base/aidl/org/mozilla/gecko/media/ICodecManager.aidl
mobile/android/base/aidl/org/mozilla/gecko/media/Sample.aidl
mobile/android/base/moz.build
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -5,34 +5,34 @@ apply plugin: 'com.android.application'
 apply plugin: 'checkstyle'
 
 android {
     compileSdkVersion 23
     buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
 
     defaultConfig {
         targetSdkVersion 23
-        minSdkVersion 15 
+        minSdkVersion 15
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
         testApplicationId 'org.mozilla.roboexample.test'
         testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
         manifestPlaceholders = [
             ANDROID_PACKAGE_NAME: mozconfig.substs.ANDROID_PACKAGE_NAME,
             MOZ_ANDROID_MIN_SDK_VERSION: mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION,
             MOZ_ANDROID_SHARED_ID: "${mozconfig.substs.ANDROID_PACKAGE_NAME}.sharedID",
         ]
         // Used by Robolectric based tests; see TestRunner.
         buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
- 
+
     dexOptions {
         javaMaxHeapSize "2g"
     }
 
     lintOptions {
         abortOnError true
     }
 
@@ -79,16 +79,20 @@ android {
             }
         }
     }
 
     sourceSets {
         main {
             manifest.srcFile "${project.buildDir}/generated/source/preprocessed_manifest/AndroidManifest.xml"
 
+            aidl {
+                srcDir "${topsrcdir}/mobile/android/base/aidl"
+            }
+
             java {
                 srcDir "${topsrcdir}/mobile/android/geckoview/src/main/java"
                 srcDir "${topsrcdir}/mobile/android/base/java"
                 srcDir "${topsrcdir}/mobile/android/search/java"
                 srcDir "${topsrcdir}/mobile/android/javaaddons/java"
                 srcDir "${topsrcdir}/mobile/android/services/src/main/java"
 
                 if (mozconfig.substs.MOZ_ANDROID_MLS_STUMBLER) {
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -538,8 +538,17 @@ libs:: jni-stubs.inc GeneratedJNIWrapper
 	  echo && \
 	  echo '* Repeat the build, and check in any changes.       *' && \
 	  echo '*****************************************************' && \
 	  exit 1)
 endif
 
 libs:: classes.dex
 	$(INSTALL) classes.dex $(FINAL_TARGET)
+
+# Generate Java binder interfaces from AIDL files.
+aidl_src_path := $(srcdir)/aidl
+aidl_target_path := generated
+media_pkg := org/mozilla/gecko/media
+
+$(aidl_target_path)/$(media_pkg)/%.java:$(aidl_src_path)/$(media_pkg)/%.aidl
+	@echo "Processing AIDL: $< => $@"
+	$(AIDL) -p$(ANDROID_SDK)/framework.aidl -I$(aidl_src_path) -o$(aidl_target_path) $<
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/FormatParam.aidl
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+parcelable FormatParam;
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/ICodec.aidl
@@ -0,0 +1,23 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+// Non-default types used in interface.
+import android.os.Bundle;
+import android.view.Surface;
+import org.mozilla.gecko.media.FormatParam;
+import org.mozilla.gecko.media.ICodecCallbacks;
+import org.mozilla.gecko.media.Sample;
+
+interface ICodec {
+    void setCallbacks(in ICodecCallbacks callbacks);
+    boolean configure(in FormatParam format, inout Surface surface, int flags);
+    oneway void start();
+    oneway void stop();
+    oneway void flush();
+    oneway void release();
+
+    oneway void queueInput(in Sample sample);
+}
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/ICodecCallbacks.aidl
@@ -0,0 +1,16 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+// Non-default types used in interface.
+import org.mozilla.gecko.media.FormatParam;
+import org.mozilla.gecko.media.Sample;
+
+interface ICodecCallbacks {
+    oneway void onInputExhausted();
+    oneway void onOutputFormatChanged(in FormatParam format);
+    oneway void onOutput(in Sample sample);
+    oneway void onError(boolean fatal);
+}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/ICodecManager.aidl
@@ -0,0 +1,13 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+// Non-default types used in interface.
+import org.mozilla.gecko.media.ICodec;
+
+interface ICodecManager {
+    /** Creates a remote ICodec object. */
+    ICodec createCodec();
+}
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/Sample.aidl
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+parcelable Sample;
\ No newline at end of file
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -1029,8 +1029,14 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']
 FINAL_TARGET_PP_FILES += ['package-name.txt.in']
 
 DEFINES['OBJDIR'] = OBJDIR
 DEFINES['TOPOBJDIR'] = TOPOBJDIR
 
 OBJDIR_PP_FILES.mobile.android.base += [
     'AndroidManifest.xml.in',
 ]
+
+gbjar.sources += ['generated/org/mozilla/gecko/' + x for x in [
+    'media/ICodec.java',
+    'media/ICodecCallbacks.java',
+    'media/ICodecManager.java',
+]]