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
Change-Id: Ic04e44aef4df772c718ff25ed331bf02f5940c1d
This commit is contained in:
markchien
2020-09-24 09:50:55 +08:00
parent 5db7c0028c
commit 84ec4a397a

View File

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