我有同样的问题,在 android 4.01 开源之后,我看到了这样的东西:
public synchronized LegacyVpnInfo getLegacyVpnInfo() {
// Only system user can call this method.
if (Binder.getCallingUid() != Process.SYSTEM_UID) {
throw new SecurityException("Unauthorized Caller");
}
return (mLegacyVpnRunner == null) ? null : mLegacyVpnRunner.getInfo();
}
或者,
// Only system user can revoke a package.
if (Binder.getCallingUid() != Process.SYSTEM_UID) {
throw new SecurityException("Unauthorized Caller");
}
或者,
public void protect(ParcelFileDescriptor socket, String interfaze) throws Exception {
PackageManager pm = mContext.getPackageManager();
ApplicationInfo app = pm.getApplicationInfo(mPackage, 0);
if (Binder.getCallingUid() != app.uid) {
throw new SecurityException("Unauthorized Caller");
}
jniProtect(socket.getFd(), interfaze);
}
但是,上面的这些代码块属于 com.android.server.connectivity.Vpn
(Vpn 类),未在 interface 中定义IConnectivityManager
。
我也在startLegacyVpnInfo()
功能中找到,但我看不到任何涉及异常的东西
“未经授权的调用者”,所以我想知道为什么startLegacyVpnInfo()
函数会抛出这个异常?
有什么解决方案吗?