Avoid data usage notifications in airplane mode.
Only for mobile networks. Bug: 5995839 Change-Id: I6a6dba8cfe98c8e72861f90665c3e41da6d9a474
This commit is contained in:
@@ -524,6 +524,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
case MATCH_MOBILE_3G_LOWER:
|
||||
case MATCH_MOBILE_4G:
|
||||
case MATCH_MOBILE_ALL:
|
||||
// mobile templates aren't relevant in airplane mode
|
||||
if (isAirplaneModeOn(mContext)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// mobile templates are relevant when subscriberid is active
|
||||
return Objects.equal(getActiveSubscriberId(), template.getSubscriberId());
|
||||
}
|
||||
@@ -1723,6 +1728,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
mHandler.getLooper().getQueue().addIdleHandler(handler);
|
||||
}
|
||||
|
||||
public static boolean isAirplaneModeOn(Context context) {
|
||||
return Settings.System.getInt(
|
||||
context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;
|
||||
}
|
||||
|
||||
private static void collectKeys(SparseIntArray source, SparseBooleanArray target) {
|
||||
final int size = source.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
Reference in New Issue
Block a user