Expose ServiceSpecificException as @SystemApi.

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
This commit is contained in:
Lorenzo Colitti
2019-01-22 17:11:01 +09:00
parent 20f1e0ca1d
commit a27da72cd1
3 changed files with 9 additions and 2 deletions

View 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();

View 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;

View 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;