| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.debug; |
| 18 |
|
| 19 |
import android.annotation.RequiresPermission; |
| 20 |
import android.annotation.SystemApi; |
| 21 |
import android.annotation.SystemService; |
| 22 |
import android.content.Context; |
| 23 |
import android.os.RemoteException; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
@SystemApi |
| 30 |
@SystemService(Context.ADB_SERVICE) |
| 31 |
public class AdbManager { |
| 32 |
private static final String TAG = "AdbManager"; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
@RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING) |
| 42 |
public static final String WIRELESS_DEBUG_STATE_CHANGED_ACTION = |
| 43 |
"com.android.server.adb.WIRELESS_DEBUG_STATUS"; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
@RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING) |
| 51 |
public static final String WIRELESS_DEBUG_PAIRED_DEVICES_ACTION = |
| 52 |
"com.android.server.adb.WIRELESS_DEBUG_PAIRED_DEVICES"; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
@RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING) |
| 65 |
public static final String WIRELESS_DEBUG_PAIRING_RESULT_ACTION = |
| 66 |
"com.android.server.adb.WIRELESS_DEBUG_PAIRING_RESULT"; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
public static final String WIRELESS_DEVICES_EXTRA = "devices_map"; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public static final String WIRELESS_STATUS_EXTRA = "status"; |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
public static final String WIRELESS_PAIR_DEVICE_EXTRA = "pair_device"; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
public static final String WIRELESS_PAIRING_CODE_EXTRA = "pairing_code"; |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
public static final String WIRELESS_DEBUG_PORT_EXTRA = "adb_port"; |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
public static final int WIRELESS_STATUS_FAIL = 0; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
public static final int WIRELESS_STATUS_SUCCESS = 1; |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
public static final int WIRELESS_STATUS_CANCELLED = 2; |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
public static final int WIRELESS_STATUS_PAIRING_CODE = 3; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
public static final int WIRELESS_STATUS_CONNECTED = 4; |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
public static final int WIRELESS_STATUS_DISCONNECTED = 5; |
| 144 |
|
| 145 |
private final Context mContext; |
| 146 |
private final IAdbManager mService; |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
public AdbManager(Context context, IAdbManager service) { |
| 152 |
mContext = context; |
| 153 |
mService = service; |
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
@SystemApi |
| 161 |
@RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING) |
| 162 |
public boolean isAdbWifiSupported() { |
| 163 |
try { |
| 164 |
return mService.isAdbWifiSupported(); |
| 165 |
} catch (RemoteException e) { |
| 166 |
throw e.rethrowFromSystemServer(); |
| 167 |
} |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
@SystemApi |
| 176 |
@RequiresPermission(android.Manifest.permission.MANAGE_DEBUGGING) |
| 177 |
public boolean isAdbWifiQrSupported() { |
| 178 |
try { |
| 179 |
return mService.isAdbWifiQrSupported(); |
| 180 |
} catch (RemoteException e) { |
| 181 |
throw e.rethrowFromSystemServer(); |
| 182 |
} |
| 183 |
} |
| 184 |
} |