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

Commit 5043fb74 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "dock_observer: allow dock rotation in OOBE" into main

parents 86f9ca8c d61fc450
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -815,6 +815,11 @@
         we rely on gravity to determine the effective orientation. -->
    <bool name="config_deskDockEnablesAccelerometer">true</bool>

    <!-- Control for allowing the dock rotation functionality before provision like
         when the SetupWizard is being shown to the user. This defaults to false to
         preserve existing behavior. -->
    <bool name="config_allowDockBeforeProvision">false</bool>

    <!-- Car dock behavior -->

    <!-- The number of degrees to rotate the display when the device is in a car dock.
+1 −0
Original line number Diff line number Diff line
@@ -1797,6 +1797,7 @@
  <java-symbol type="bool" name="config_customUserSwitchUi" />
  <java-symbol type="bool" name="config_canRemoveFirstAccount" />
  <java-symbol type="string" name="config_accountTypeToKeepFirstAccount" />
  <java-symbol type="bool" name="config_allowDockBeforeProvision" />
  <java-symbol type="bool" name="config_deskDockEnablesAccelerometer" />
  <java-symbol type="bool" name="config_disableMenuKeyInLockScreen" />
  <java-symbol type="bool" name="config_enableCarDockHomeLaunch" />
+14 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.media.AudioManager;
import android.media.Ringtone;
@@ -35,6 +36,7 @@ import android.provider.Settings;
import android.util.Pair;
import android.util.Slog;

import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.FrameworkStatsLog;
@@ -259,12 +261,20 @@ final class DockObserver extends SystemService {
                    + mReportedDockState);
            final int previousDockState = mPreviousDockState;
            mPreviousDockState = mReportedDockState;
            // Skip the dock intent if not yet provisioned.

            final ContentResolver cr = getContext().getContentResolver();

            /// If the allow dock rotation before provision is enabled then we allow rotation.
            final Resources r = getContext().getResources();
            final boolean allowDockBeforeProvision =
                    r.getBoolean(R.bool.config_allowDockBeforeProvision);
            if (!allowDockBeforeProvision) {
                // Skip the dock intent if not yet provisioned.
                if (!mDeviceProvisionedObserver.isDeviceProvisioned()) {
                    Slog.i(TAG, "Device not provisioned, skipping dock broadcast");
                    return;
                }
            }

            // Pack up the values and broadcast them to everyone
            Intent intent = new Intent(Intent.ACTION_DOCK_EVENT);