Fix TetheredClient callback fail in InProcessTethering

TetheredClient callback would additional check whether caller has
NETWORK_SETTINGS or {MAINLINE_}NETWORK_STACK permission, but it do not
grant for self accessing. InProcessTethering run in system server, so
the services in system server would fail to call TetheredClient callback.
Grant permission for self process.

Bug: 169231588
Test: atest CtsTetheringTest

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1435273

Change-Id: I8faacd26cc6f3e940af3a0147b84b693cb93503c
Merged-In: Ic04e44aef4df772c718ff25ed331bf02f5940c1d
(cherry picked from commit 0c9a370cfc)
This commit is contained in:
Treehugger Robot
2020-09-28 09:50:14 +00:00
committed by Mark Chien
parent 20dd58aa8d
commit 0afc3ce6a7

View File

@@ -2104,7 +2104,7 @@ public class Tethering {
}
private boolean hasCallingPermission(@NonNull String permission) {
return mContext.checkCallingPermission(permission) == PERMISSION_GRANTED;
return mContext.checkCallingOrSelfPermission(permission) == PERMISSION_GRANTED;
}
/** Unregister tethering event callback */