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

Commit 847dfb4b authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6258405 from 2e112273 to qt-qpr3-release

Change-Id: Ie954a9b411d8f4a19f9e7c30b43002588a1c4254
parents 68fbc156 2e112273
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
@@ -635,6 +635,66 @@ message RouterFingerPrint {
    ROUTER_TECH_OTHER = 6;
  }

  enum EapMethod {

    // No EAP method used
    TYPE_EAP_UNKNOWN = 0;

    // EAP with Transport Layer Security
    TYPE_EAP_TLS = 1;

    // EAP with Tunneled Transport Layer Security
    TYPE_EAP_TTLS = 2;

    // EAP with Subscriber Identity Module [RFC-4186]
    TYPE_EAP_SIM = 3;

    // EAP with Authentication and Key Agreement [RFC-4187]
    TYPE_EAP_AKA = 4;

    // EAP with Authentication and Key Agreement Prime [RFC-5448]
    TYPE_EAP_AKA_PRIME = 5;

    // Protected EAP
    TYPE_EAP_PEAP = 6;

    // EAP for Hotspot 2.0 r2 OSEN
    TYPE_EAP_UNAUTH_TLS = 7;

    // EAP with Password
    TYPE_EAP_PWD = 8;

    // EAP with WAPI certifcate
    TYPE_EAP_WAPI_CERT = 9;
  }

  enum AuthPhase2Method {

    // No phase2 method
    TYPE_PHASE2_NONE = 0;

    // Password Authentication Protocol
    TYPE_PHASE2_PAP = 1;

    // Microsoft Challenge Handshake Authentication Protocol
    TYPE_PHASE2_MSCHAP = 2;

    // Microsoft Challenge Handshake Authentication Protocol v2
    TYPE_PHASE2_MSCHAPV2 = 3;

    // Generic Token Card
    TYPE_PHASE2_GTC = 4;

    // EAP-Subscriber Identity Module [RFC-4186]
    TYPE_PHASE2_SIM = 5;

    // EAP-Authentication and Key Agreement [RFC-4187]
    TYPE_PHASE2_AKA = 6;

    // EAP-Authentication and Key Agreement Prime [RFC-5448]
    TYPE_PHASE2_AKA_PRIME   = 7;
  }

  optional RoamType roam_type = 1;

  // Channel on which the connection takes place.
@@ -657,6 +717,12 @@ message RouterFingerPrint {

  // If the router is a passpoint / hotspot 2.0 network
  optional bool passpoint = 8;

  // EAP method used by the enterprise network
  optional EapMethod eap_method = 9;

  // Phase 2 authentication method after setting up a secure channel
  optional AuthPhase2Method auth_phase2_method = 10;
}

message ConnectionEvent {
+81 −47
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server;

import android.annotation.IntRange;
import android.annotation.Nullable;
import android.app.Activity;
import android.app.ActivityManager;
@@ -41,6 +42,7 @@ import android.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager.ServiceType;
import android.os.PowerManagerInternal;
import android.os.Process;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
@@ -67,6 +69,10 @@ import com.android.server.wm.WindowManagerInternal;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Map;

import static android.app.UiModeManager.MODE_NIGHT_AUTO;
import static android.app.UiModeManager.MODE_NIGHT_YES;

final class UiModeManagerService extends SystemService {
    private static final String TAG = UiModeManager.class.getSimpleName();
@@ -124,6 +130,7 @@ final class UiModeManagerService extends SystemService {
    private NotificationManager mNotificationManager;
    private StatusBarManager mStatusBarManager;
    private WindowManagerInternal mWindowManager;
    private PowerManager mPowerManager;

    private PowerManager.WakeLock mWakeLock;

@@ -136,11 +143,12 @@ final class UiModeManagerService extends SystemService {
    @VisibleForTesting
    protected UiModeManagerService(Context context, WindowManagerInternal wm,
                                   PowerManager.WakeLock wl, TwilightManager tm,
                                   boolean setupWizardComplete) {
                                   PowerManager pm, boolean setupWizardComplete) {
        super(context);
        mWindowManager = wm;
        mWakeLock = wl;
        mTwilightManager = tm;
        mPowerManager = pm;
        mSetupWizardComplete = setupWizardComplete;
    }

@@ -261,13 +269,18 @@ final class UiModeManagerService extends SystemService {
    private final ContentObserver mDarkThemeObserver = new ContentObserver(mHandler) {
        @Override
        public void onChange(boolean selfChange, Uri uri) {
            updateSystemProperties();
        }
    };

    private void updateSystemProperties() {
        int mode = Secure.getIntForUser(getContext().getContentResolver(), Secure.UI_NIGHT_MODE,
                mNightMode, 0);
            mode = mode == UiModeManager.MODE_NIGHT_AUTO
                    ? UiModeManager.MODE_NIGHT_YES : mode;
        if (mode == MODE_NIGHT_AUTO) {
            mode = MODE_NIGHT_YES;
        }
        SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME, Integer.toString(mode));
    }
    };

    @Override
    public void onSwitchUser(int userHandle) {
@@ -280,9 +293,9 @@ final class UiModeManagerService extends SystemService {
    public void onStart() {
        final Context context = getContext();

        final PowerManager powerManager =
        mPowerManager =
                (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
        mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
        mWindowManager = LocalServices.getService(WindowManagerInternal.class);

        // If setup isn't complete for this user listen for completion so we can unblock
@@ -349,6 +362,7 @@ final class UiModeManagerService extends SystemService {

        context.getContentResolver().registerContentObserver(Secure.getUriFor(Secure.UI_NIGHT_MODE),
                false, mDarkThemeObserver, 0);
        mHandler.post(() -> updateSystemProperties());
    }

    @VisibleForTesting
@@ -406,6 +420,7 @@ final class UiModeManagerService extends SystemService {
    }

    private void registerScreenOffEvent() {
        if (mPowerSave) return;
        mWaitForScreenOff = true;
        final IntentFilter intentFilter =
                new IntentFilter(Intent.ACTION_SCREEN_OFF);
@@ -510,7 +525,9 @@ final class UiModeManagerService extends SystemService {
                            persistNightMode(user);
                        }
                        // on screen off will update configuration instead
                        if (mNightMode != UiModeManager.MODE_NIGHT_AUTO || mCar) {
                        if ((mNightMode != MODE_NIGHT_AUTO)
                                || shouldApplyAutomaticChangesImmediately()) {
                            unregisterScreenOffEvent();
                            updateLocked(0, 0);
                        } else {
                            registerScreenOffEvent();
@@ -600,6 +617,7 @@ final class UiModeManagerService extends SystemService {
            pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode));
            pw.print("  mHoldingConfiguration="); pw.print(mHoldingConfiguration);
            pw.print(" mSystemReady="); pw.println(mSystemReady);

            if (mTwilightManager != null) {
                // We may not have a TwilightManager.
                pw.print("  mTwilightService.getLastTwilightState()=");
@@ -615,7 +633,6 @@ final class UiModeManagerService extends SystemService {
                mTwilightManager = getLocalService(TwilightManager.class);
                mSystemReady = true;
                mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR;
                updateComputedNightModeLocked();
                registerVrStateListener();
                updateLocked(0, 0);
            }
@@ -683,24 +700,31 @@ final class UiModeManagerService extends SystemService {
            uiMode = Configuration.UI_MODE_TYPE_VR_HEADSET;
        }

        if (mNightMode == UiModeManager.MODE_NIGHT_AUTO) {
        if (mNightMode == MODE_NIGHT_YES || mNightMode == UiModeManager.MODE_NIGHT_NO) {
            mComputedNightMode = mNightMode == MODE_NIGHT_YES;
        }

        if (mNightMode == MODE_NIGHT_AUTO) {
            boolean activateNightMode = mComputedNightMode;
            if (mTwilightManager != null) {
                mTwilightManager.registerListener(mTwilightListener, mHandler);
                final TwilightState lastState = mTwilightManager.getLastTwilightState();
                activateNightMode = lastState == null ? mComputedNightMode : lastState.isNight();
            }
            updateComputedNightModeLocked();
            uiMode |= mComputedNightMode ? Configuration.UI_MODE_NIGHT_YES
                    : Configuration.UI_MODE_NIGHT_NO;

            updateComputedNightModeLocked(activateNightMode);
        } else {
            if (mTwilightManager != null) {
                mTwilightManager.unregisterListener(mTwilightListener);
            }
            uiMode |= mNightMode << 4;
        }

        // Override night mode in power save mode if not in car mode
        if (mPowerSave && !mCarModeEnabled) {
            uiMode &= ~Configuration.UI_MODE_NIGHT_NO;
            uiMode |= Configuration.UI_MODE_NIGHT_YES;
        } else {
            uiMode = getComputedUiModeConfiguration(uiMode);
        }

        if (LOG) {
@@ -712,11 +736,20 @@ final class UiModeManagerService extends SystemService {
        }

        mCurUiMode = uiMode;
        if (!mHoldingConfiguration || !mWaitForScreenOff) {
        if (!mHoldingConfiguration && (!mWaitForScreenOff || mPowerSave)) {
            mConfiguration.uiMode = uiMode;
        }
    }

    @UiModeManager.NightMode
    private int getComputedUiModeConfiguration(@UiModeManager.NightMode int uiMode) {
        uiMode |= mComputedNightMode ? Configuration.UI_MODE_NIGHT_YES
                : Configuration.UI_MODE_NIGHT_NO;
        uiMode &= mComputedNightMode ? ~Configuration.UI_MODE_NIGHT_NO
                : ~Configuration.UI_MODE_NIGHT_YES;
        return uiMode;
    }

    private void applyConfigurationExternallyLocked() {
        if (mSetUiMode != mConfiguration.uiMode) {
            mSetUiMode = mConfiguration.uiMode;
@@ -724,8 +757,14 @@ final class UiModeManagerService extends SystemService {
                ActivityTaskManager.getService().updateConfiguration(mConfiguration);
            } catch (RemoteException e) {
                Slog.w(TAG, "Failure communicating with activity manager", e);
            } catch (SecurityException e) {
                Slog.e(TAG, "Activity does not have the ", e);
            }
        }
    }

    private boolean shouldApplyAutomaticChangesImmediately() {
        return mCar || !mPowerManager.isInteractive();
    }

    void updateLocked(int enableFlags, int disableFlags) {
@@ -958,12 +997,8 @@ final class UiModeManagerService extends SystemService {
        }
    }

    private void updateComputedNightModeLocked() {
        if (mTwilightManager != null) {
            TwilightState state = mTwilightManager.getLastTwilightState();
            if (state != null) {
                mComputedNightMode = state.isNight();
            }
    private void updateComputedNightModeLocked(boolean activate) {
        mComputedNightMode = activate;
        if (mNightModeOverride == UiModeManager.MODE_NIGHT_YES && !mComputedNightMode) {
            mComputedNightMode = true;
            return;
@@ -978,7 +1013,6 @@ final class UiModeManagerService extends SystemService {
        Secure.putIntForUser(getContext().getContentResolver(),
                OVERRIDE_NIGHT_MODE, mNightModeOverride, user);
    }
    }

    private void registerVrStateListener() {
        IVrManager vrManager = IVrManager.Stub.asInterface(ServiceManager.getService(
+7 −4
Original line number Diff line number Diff line
@@ -416,7 +416,8 @@ public class FocusRequester {
    }

    int dispatchFocusChange(int focusChange) {
        if (mFocusDispatcher == null) {
        final IAudioFocusDispatcher fd = mFocusDispatcher;
        if (fd == null) {
            if (MediaFocusControl.DEBUG) { Log.e(TAG, "dispatchFocusChange: no focus dispatcher"); }
            return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
        }
@@ -436,7 +437,7 @@ public class FocusRequester {
            mFocusLossReceived = focusChange;
        }
        try {
            mFocusDispatcher.dispatchAudioFocusChange(focusChange, mClientId);
            fd.dispatchAudioFocusChange(focusChange, mClientId);
        } catch (android.os.RemoteException e) {
            Log.e(TAG, "dispatchFocusChange: error talking to focus listener " + mClientId, e);
            return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
@@ -445,16 +446,18 @@ public class FocusRequester {
    }

    void dispatchFocusResultFromExtPolicy(int requestResult) {
        if (mFocusDispatcher == null) {
        final IAudioFocusDispatcher fd = mFocusDispatcher;
        if (fd == null) {
            if (MediaFocusControl.DEBUG) {
                Log.e(TAG, "dispatchFocusResultFromExtPolicy: no focus dispatcher");
            }
            return;
        }
        if (DEBUG) {
            Log.v(TAG, "dispatching result" + requestResult + " to " + mClientId);
        }
        try {
            mFocusDispatcher.dispatchFocusResultFromExtPolicy(requestResult, mClientId);
            fd.dispatchFocusResultFromExtPolicy(requestResult, mClientId);
        } catch (android.os.RemoteException e) {
            Log.e(TAG, "dispatchFocusResultFromExtPolicy: error talking to focus listener"
                    + mClientId, e);
+4 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.PowerManager;
import android.os.PowerManagerInternal;
import android.os.RemoteException;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -66,12 +67,14 @@ public class UiModeManagerServiceTest extends UiServiceTestCase {
    TwilightManager mTwilightManager;
    @Mock
    PowerManager.WakeLock mWakeLock;
    @Mock
    PowerManager mPowerManager;
    private Set<BroadcastReceiver> mScreenOffRecievers;

    @Before
    public void setUp() {
        mUiManagerService = new UiModeManagerService(mContext, mWindowManager, mWakeLock,
                mTwilightManager, true);
                mTwilightManager, mPowerManager, true);
        mScreenOffRecievers = new HashSet<>();
        mService = mUiManagerService.getService();
        when(mContext.checkCallingOrSelfPermission(anyString()))
+1 −1
Original line number Diff line number Diff line
@@ -3167,7 +3167,7 @@ public class CarrierConfigManager {
     * @hide
     */
    public static final String KEY_DATA_SWITCH_VALIDATION_MIN_GAP_LONG =
            "data_switch_validation_min_gap_LONG";
            "data_switch_validation_min_gap_long";

    /**
    * A boolean property indicating whether this subscription should be managed as an opportunistic