Merge "Change initialize methods in sample apps"
diff --git a/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java b/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java
index ea0fd6e..afac316 100644
--- a/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java
+++ b/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsSampleDownloadService.java
@@ -68,29 +68,15 @@
 
     private final IMbmsDownloadService mBinder = new MbmsDownloadServiceBase() {
         @Override
-        public void initialize(int subId, IMbmsDownloadManagerCallback listener) {
+        public int initialize(int subId, IMbmsDownloadManagerCallback listener) {
             int packageUid = Binder.getCallingUid();
             String[] packageNames = getPackageManager().getPackagesForUid(packageUid);
             if (packageNames == null) {
-                try {
-                    listener.error(
-                            MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
-                            "No matching packages found for your UID");
-                } catch (RemoteException e) {
-                    // ignore
-                }
-                return;
+                return MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED;
             }
             boolean isUidAllowed = Arrays.stream(packageNames).anyMatch(ALLOWED_PACKAGES::contains);
             if (!isUidAllowed) {
-                try {
-                    listener.error(
-                            MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
-                            "No packages for your UID are allowed to use this service.");
-                } catch (RemoteException e) {
-                    // ignore
-                }
-                return;
+                return MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED;
             }
 
             // Do initialization with a bit of a delay to simulate work being done.
@@ -116,6 +102,8 @@
                     // TODO: call dispose
                 }
             }, INITIALIZATION_DELAY);
+
+            return MbmsException.SUCCESS;
         }
 
         @Override
diff --git a/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsTestStreamingService.java b/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsTestStreamingService.java
index 0373597..94346f7 100644
--- a/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsTestStreamingService.java
+++ b/testapps/EmbmsServiceTestApp/src/com/android/phone/testapps/embmsmw/EmbmsTestStreamingService.java
@@ -81,29 +81,15 @@
 
     private final IMbmsStreamingService.Stub mBinder = new MbmsStreamingServiceBase() {
         @Override
-        public void initialize(IMbmsStreamingManagerCallback listener, int subId) {
+        public int initialize(IMbmsStreamingManagerCallback listener, int subId) {
             int packageUid = Binder.getCallingUid();
             String[] packageNames = getPackageManager().getPackagesForUid(packageUid);
             if (packageNames == null) {
-                try {
-                    listener.error(
-                            MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
-                            "No matching packages found for your UID");
-                } catch (RemoteException e) {
-                    // ignore
-                }
-                return;
+                return MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED;
             }
             boolean isUidAllowed = Arrays.stream(packageNames).anyMatch(ALLOWED_PACKAGES::contains);
             if (!isUidAllowed) {
-                try {
-                    listener.error(
-                            MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
-                            "No packages for your UID are allowed to use this service.");
-                } catch (RemoteException e) {
-                    // ignore
-                }
-                return;
+                return MbmsException.InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED;
             }
 
             mHandler.postDelayed(() -> {
@@ -126,6 +112,7 @@
                     mAppCallbacks.remove(appKey);
                 }
             }, INITIALIZATION_DELAY);
+            return MbmsException.SUCCESS;
         }
 
         @Override