Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls"
This commit is contained in:
committed by
Android (Google) Code Review
commit
f4c703461d
@@ -22,25 +22,31 @@ import android.os.ResultReceiver;
|
||||
|
||||
/** @hide */
|
||||
oneway interface ITetheringConnector {
|
||||
void tether(String iface, String callerPkg, IIntResultListener receiver);
|
||||
|
||||
void untether(String iface, String callerPkg, IIntResultListener receiver);
|
||||
|
||||
void setUsbTethering(boolean enable, String callerPkg, IIntResultListener receiver);
|
||||
|
||||
void startTethering(in TetheringRequestParcel request, String callerPkg,
|
||||
void tether(String iface, String callerPkg, String callingAttributionTag,
|
||||
IIntResultListener receiver);
|
||||
|
||||
void stopTethering(int type, String callerPkg, IIntResultListener receiver);
|
||||
void untether(String iface, String callerPkg, String callingAttributionTag,
|
||||
IIntResultListener receiver);
|
||||
|
||||
void setUsbTethering(boolean enable, String callerPkg,
|
||||
String callingAttributionTag, IIntResultListener receiver);
|
||||
|
||||
void startTethering(in TetheringRequestParcel request, String callerPkg,
|
||||
String callingAttributionTag, IIntResultListener receiver);
|
||||
|
||||
void stopTethering(int type, String callerPkg, String callingAttributionTag,
|
||||
IIntResultListener receiver);
|
||||
|
||||
void requestLatestTetheringEntitlementResult(int type, in ResultReceiver receiver,
|
||||
boolean showEntitlementUi, String callerPkg);
|
||||
boolean showEntitlementUi, String callerPkg, String callingAttributionTag);
|
||||
|
||||
void registerTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
|
||||
|
||||
void unregisterTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
|
||||
|
||||
void isTetheringSupported(String callerPkg, IIntResultListener receiver);
|
||||
void isTetheringSupported(String callerPkg, String callingAttributionTag,
|
||||
IIntResultListener receiver);
|
||||
|
||||
void stopAllTethering(String callerPkg, IIntResultListener receiver);
|
||||
void stopAllTethering(String callerPkg, String callingAttributionTag,
|
||||
IIntResultListener receiver);
|
||||
}
|
||||
|
||||
@@ -484,13 +484,20 @@ public class TetheringManager {
|
||||
|
||||
return dispatcher.waitForResult((connector, listener) -> {
|
||||
try {
|
||||
connector.tether(iface, callerPkg, listener);
|
||||
connector.tether(iface, callerPkg, getAttributionTag(), listener);
|
||||
} catch (RemoteException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the context's attribution tag
|
||||
*/
|
||||
private @Nullable String getAttributionTag() {
|
||||
return mContext.getAttributionTag();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop tethering the named interface.
|
||||
*
|
||||
@@ -509,7 +516,7 @@ public class TetheringManager {
|
||||
|
||||
return dispatcher.waitForResult((connector, listener) -> {
|
||||
try {
|
||||
connector.untether(iface, callerPkg, listener);
|
||||
connector.untether(iface, callerPkg, getAttributionTag(), listener);
|
||||
} catch (RemoteException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
@@ -536,7 +543,8 @@ public class TetheringManager {
|
||||
|
||||
return dispatcher.waitForResult((connector, listener) -> {
|
||||
try {
|
||||
connector.setUsbTethering(enable, callerPkg, listener);
|
||||
connector.setUsbTethering(enable, callerPkg, getAttributionTag(),
|
||||
listener);
|
||||
} catch (RemoteException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
@@ -735,7 +743,8 @@ public class TetheringManager {
|
||||
});
|
||||
}
|
||||
};
|
||||
getConnector(c -> c.startTethering(request.getParcel(), callerPkg, listener));
|
||||
getConnector(c -> c.startTethering(request.getParcel(), callerPkg,
|
||||
getAttributionTag(), listener));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -775,7 +784,8 @@ public class TetheringManager {
|
||||
final String callerPkg = mContext.getOpPackageName();
|
||||
Log.i(TAG, "stopTethering caller:" + callerPkg);
|
||||
|
||||
getConnector(c -> c.stopTethering(type, callerPkg, new IIntResultListener.Stub() {
|
||||
getConnector(c -> c.stopTethering(type, callerPkg, getAttributionTag(),
|
||||
new IIntResultListener.Stub() {
|
||||
@Override
|
||||
public void onResult(int resultCode) {
|
||||
// TODO: provide an API to obtain result
|
||||
@@ -861,7 +871,7 @@ public class TetheringManager {
|
||||
Log.i(TAG, "getLatestTetheringEntitlementResult caller:" + callerPkg);
|
||||
|
||||
getConnector(c -> c.requestLatestTetheringEntitlementResult(
|
||||
type, receiver, showEntitlementUi, callerPkg));
|
||||
type, receiver, showEntitlementUi, callerPkg, getAttributionTag()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1312,7 +1322,7 @@ public class TetheringManager {
|
||||
final RequestDispatcher dispatcher = new RequestDispatcher();
|
||||
final int ret = dispatcher.waitForResult((connector, listener) -> {
|
||||
try {
|
||||
connector.isTetheringSupported(callerPkg, listener);
|
||||
connector.isTetheringSupported(callerPkg, getAttributionTag(), listener);
|
||||
} catch (RemoteException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
@@ -1335,14 +1345,15 @@ public class TetheringManager {
|
||||
final String callerPkg = mContext.getOpPackageName();
|
||||
Log.i(TAG, "stopAllTethering caller:" + callerPkg);
|
||||
|
||||
getConnector(c -> c.stopAllTethering(callerPkg, new IIntResultListener.Stub() {
|
||||
@Override
|
||||
public void onResult(int resultCode) {
|
||||
// TODO: add an API parameter to send result to caller.
|
||||
// This has never been possible as stopAllTethering has always been void and never
|
||||
// taken a callback object. The only indication that callers have is if the call
|
||||
// results in a TETHER_STATE_CHANGE broadcast.
|
||||
}
|
||||
}));
|
||||
getConnector(c -> c.stopAllTethering(callerPkg, getAttributionTag(),
|
||||
new IIntResultListener.Stub() {
|
||||
@Override
|
||||
public void onResult(int resultCode) {
|
||||
// TODO: add an API parameter to send result to caller.
|
||||
// This has never been possible as stopAllTethering has always been void
|
||||
// and never taken a callback object. The only indication that callers have
|
||||
// is if the call results in a TETHER_STATE_CHANGE broadcast.
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user