Merge "Passing caller package name to setBluetoothTethering" am: 751f034b82 am: b2d0c6357c am: 8e3ad12386

am: f1575b130f

Change-Id: I5df2aea7161a4261fa98ef7ed8567ff2ef0d0692
This commit is contained in:
Mark Chien
2019-08-28 03:31:20 -07:00
committed by android-build-merger
2 changed files with 20 additions and 3 deletions

View File

@@ -118,6 +118,8 @@ public final class BluetoothPan implements BluetoothProfile {
*/
public static final int PAN_OPERATION_SUCCESS = 1004;
private final Context mContext;
private BluetoothAdapter mAdapter;
private final BluetoothProfileConnector<IBluetoothPan> mProfileConnector =
new BluetoothProfileConnector(this, BluetoothProfile.PAN,
@@ -136,6 +138,7 @@ public final class BluetoothPan implements BluetoothProfile {
@UnsupportedAppUsage
/*package*/ BluetoothPan(Context context, ServiceListener listener) {
mAdapter = BluetoothAdapter.getDefaultAdapter();
mContext = context;
mProfileConnector.connect(context, listener);
}
@@ -287,11 +290,12 @@ public final class BluetoothPan implements BluetoothProfile {
@UnsupportedAppUsage
public void setBluetoothTethering(boolean value) {
if (DBG) log("setBluetoothTethering(" + value + ")");
String pkgName = mContext.getOpPackageName();
if (DBG) log("setBluetoothTethering(" + value + "), calling package:" + pkgName);
final IBluetoothPan service = getService();
if (service != null && isEnabled()) {
try {
service.setBluetoothTethering(value);
service.setBluetoothTethering(value, pkgName);
} catch (RemoteException e) {
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
}