OSDN Git Service

Expose ServiceSpecificException as @SystemApi.
authorLorenzo Colitti <lorenzo@google.com>
Tue, 22 Jan 2019 08:11:01 +0000 (17:11 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Tue, 22 Jan 2019 09:44:12 +0000 (18:44 +0900)
This class is useful as a system API because:

- It is one of the few exceptions that is natively Parcelable.
- It is directly supported by native code without using JNI,
  using Status::fromServiceSpecificError.
- Unlike other natively parcelable exceptions, it contains both
  an error message and an error code.

Test: m
Bug: 112869080
Change-Id: Ica3e88c2b6877e429a61b053d75f69b9f19fc74a

api/system-current.txt
config/hiddenapi-greylist.txt
core/java/android/os/ServiceSpecificException.java

index 1320d14..bf1368b 100644 (file)
@@ -4001,6 +4001,12 @@ package android.os {
     method public void onResult(android.os.Bundle);
   }
 
+  public class ServiceSpecificException extends java.lang.RuntimeException {
+    ctor public ServiceSpecificException(int, String);
+    ctor public ServiceSpecificException(int);
+    field public final int errorCode;
+  }
+
   public final class StatsDimensionsValue implements android.os.Parcelable {
     method public int describeContents();
     method public boolean getBooleanValue();
index 2bd813e..3194b8b 100644 (file)
@@ -1057,8 +1057,6 @@ Landroid/os/ServiceManager;->sServiceManager:Landroid/os/IServiceManager;
 Landroid/os/ServiceManagerNative;->asInterface(Landroid/os/IBinder;)Landroid/os/IServiceManager;
 Landroid/os/ServiceManagerProxy;->getService(Ljava/lang/String;)Landroid/os/IBinder;
 Landroid/os/ServiceManagerProxy;->mRemote:Landroid/os/IBinder;
-Landroid/os/ServiceSpecificException;-><init>(ILjava/lang/String;)V
-Landroid/os/ServiceSpecificException;->errorCode:I
 Landroid/os/SharedMemory;->getFd()I
 Landroid/os/ShellCommand;->peekNextArg()Ljava/lang/String;
 Landroid/os/StatFs;->mStat:Landroid/system/StructStatVfs;
index 3e0f6da..3b0f26a 100644 (file)
@@ -15,6 +15,8 @@
  */
 package android.os;
 
+import android.annotation.SystemApi;
+
 /**
  * An exception specific to a service.
  *
@@ -28,6 +30,7 @@ package android.os;
  *
  * @hide
  */
+@SystemApi
 public class ServiceSpecificException extends RuntimeException {
     public final int errorCode;