Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4259fc65 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Avoid data usage notifications in airplane mode."

parents 848763da 3a66cf3e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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++) {