Merge "Handle lockdown VPN reset intent in ConnectivityService" am: 63b0d576a0 am: 8ea944d77a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1413614 Change-Id: I4eb9d53d1136ba6e4b9e1fdb884e0920567db2f7
This commit is contained in:
commit
ecf857098c
1 changed files with 21 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.android.server;
|
package com.android.server;
|
||||||
|
|
||||||
|
import static android.Manifest.permission.NETWORK_STACK;
|
||||||
import static android.Manifest.permission.RECEIVE_DATA_ACTIVITY_CHANGE;
|
import static android.Manifest.permission.RECEIVE_DATA_ACTIVITY_CHANGE;
|
||||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||||
import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.KEY_NETWORK_PROBES_ATTEMPTED_BITMASK;
|
import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.KEY_NETWORK_PROBES_ATTEMPTED_BITMASK;
|
||||||
|
|
@ -1136,6 +1137,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||||
null /* broadcastPermission */,
|
null /* broadcastPermission */,
|
||||||
mHandler);
|
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 {
|
try {
|
||||||
mNMS.registerObserver(mDataActivityObserver);
|
mNMS.registerObserver(mDataActivityObserver);
|
||||||
} catch (RemoteException e) {
|
} 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() {
|
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
@ -5214,6 +5227,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||||
final Uri packageData = intent.getData();
|
final Uri packageData = intent.getData();
|
||||||
final String packageName =
|
final String packageName =
|
||||||
packageData != null ? packageData.getSchemeSpecificPart() : null;
|
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 (userId == UserHandle.USER_NULL) return;
|
||||||
|
|
||||||
if (Intent.ACTION_USER_STARTED.equals(action)) {
|
if (Intent.ACTION_USER_STARTED.equals(action)) {
|
||||||
|
|
@ -5232,6 +5251,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||||
final boolean isReplacing = intent.getBooleanExtra(
|
final boolean isReplacing = intent.getBooleanExtra(
|
||||||
Intent.EXTRA_REPLACING, false);
|
Intent.EXTRA_REPLACING, false);
|
||||||
onPackageRemoved(packageName, uid, isReplacing);
|
onPackageRemoved(packageName, uid, isReplacing);
|
||||||
|
} else {
|
||||||
|
Log.wtf(TAG, "received unexpected intent: " + action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue