| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.content.ComponentName; |
| 22 |
import android.os.Bundle; |
| 23 |
import android.util.AndroidRuntimeException; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class RemoteServiceException extends AndroidRuntimeException { |
| 36 |
public RemoteServiceException(String msg) { |
| 37 |
super(msg); |
| 38 |
} |
| 39 |
|
| 40 |
public RemoteServiceException(String msg, Throwable cause) { |
| 41 |
super(msg, cause); |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
public static class ForegroundServiceDidNotStartInTimeException extends RemoteServiceException { |
| 52 |
|
| 53 |
public static final int TYPE_ID = 1; |
| 54 |
|
| 55 |
private static final String KEY_SERVICE_CLASS_NAME = "serviceclassname"; |
| 56 |
|
| 57 |
public ForegroundServiceDidNotStartInTimeException(String msg, Throwable cause) { |
| 58 |
super(msg, cause); |
| 59 |
} |
| 60 |
|
| 61 |
public static Bundle createExtrasForService(@NonNull ComponentName service) { |
| 62 |
Bundle b = new Bundle(); |
| 63 |
b.putString(KEY_SERVICE_CLASS_NAME, service.getClassName()); |
| 64 |
return b; |
| 65 |
} |
| 66 |
|
| 67 |
@Nullable |
| 68 |
public static String getServiceClassNameFromExtras(@Nullable Bundle extras) { |
| 69 |
return (extras == null) ? null : extras.getString(KEY_SERVICE_CLASS_NAME); |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
public static class CannotPostForegroundServiceNotificationException |
| 80 |
extends RemoteServiceException { |
| 81 |
|
| 82 |
public static final int TYPE_ID = 2; |
| 83 |
|
| 84 |
public CannotPostForegroundServiceNotificationException(String msg) { |
| 85 |
super(msg); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
public static class BadForegroundServiceNotificationException extends RemoteServiceException { |
| 96 |
|
| 97 |
public static final int TYPE_ID = 3; |
| 98 |
|
| 99 |
public BadForegroundServiceNotificationException(String msg) { |
| 100 |
super(msg); |
| 101 |
} |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
public static class MissingRequestPasswordComplexityPermissionException |
| 111 |
extends RemoteServiceException { |
| 112 |
|
| 113 |
public static final int TYPE_ID = 4; |
| 114 |
|
| 115 |
public MissingRequestPasswordComplexityPermissionException(String msg) { |
| 116 |
super(msg); |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
public static class CrashedByAdbException extends RemoteServiceException { |
| 126 |
|
| 127 |
public static final int TYPE_ID = 5; |
| 128 |
|
| 129 |
public CrashedByAdbException(String msg) { |
| 130 |
super(msg); |
| 131 |
} |
| 132 |
} |
| 133 |
} |