Merge "Handle lockdown VPN reset intent in ConnectivityService" am: 68bbf71c37 am: 8ea944d77a am: baedafcc46
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1413614 Change-Id: I907b35a02c0957ae57f55ae960df1ff5fce0be8e
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server;
|
||||
|
||||
import static android.Manifest.permission.NETWORK_STACK;
|
||||
import static android.Manifest.permission.RECEIVE_DATA_ACTIVITY_CHANGE;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.KEY_NETWORK_PROBES_ATTEMPTED_BITMASK;
|
||||
@@ -1136,6 +1137,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
null /* broadcastPermission */,
|
||||
mHandler);
|
||||
|
||||
// Listen to lockdown VPN reset.
|
||||
intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(LockdownVpnTracker.ACTION_LOCKDOWN_RESET);
|
||||
mContext.registerReceiverAsUser(
|
||||
mIntentReceiver, UserHandle.ALL, intentFilter, NETWORK_STACK, mHandler);
|
||||
|
||||
try {
|
||||
mNMS.registerObserver(mDataActivityObserver);
|
||||
} catch (RemoteException e) {
|
||||
@@ -5204,6 +5211,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private void onVpnLockdownReset() {
|
||||
synchronized (mVpns) {
|
||||
if (mLockdownTracker != null) mLockdownTracker.reset();
|
||||
}
|
||||
}
|
||||
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
@@ -5214,6 +5227,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
final Uri packageData = intent.getData();
|
||||
final String packageName =
|
||||
packageData != null ? packageData.getSchemeSpecificPart() : null;
|
||||
|
||||
if (LockdownVpnTracker.ACTION_LOCKDOWN_RESET.equals(action)) {
|
||||
onVpnLockdownReset();
|
||||
}
|
||||
|
||||
// UserId should be filled for below intents, check the existence.
|
||||
if (userId == UserHandle.USER_NULL) return;
|
||||
|
||||
if (Intent.ACTION_USER_STARTED.equals(action)) {
|
||||
@@ -5232,6 +5251,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
final boolean isReplacing = intent.getBooleanExtra(
|
||||
Intent.EXTRA_REPLACING, false);
|
||||
onPackageRemoved(packageName, uid, isReplacing);
|
||||
} else {
|
||||
Log.wtf(TAG, "received unexpected intent: " + action);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user