Merge "Move SetupWizardScreenLockActivity off CarSettingActivity" into pi-car-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index db6e3b3..d1c09a7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -119,6 +119,7 @@
<action android:name="android.car.settings.SETUP_WIZARD_SCREEN_LOCK_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
+ <meta-data android:name="distractionOptimized" android:value="true"/>
</activity>
<activity android:name=".security.CheckLockActivity"
diff --git a/res/layout/suw_action_bar_with_button.xml b/res/layout/suw_action_bar_with_button.xml
index fc5ba27..735d6f7 100644
--- a/res/layout/suw_action_bar_with_button.xml
+++ b/res/layout/suw_action_bar_with_button.xml
@@ -48,6 +48,7 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/car_button_height"
android:layout_toStartOf="@id/action_button1"
+ android:layout_marginEnd="@dimen/car_padding_4"
android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="1"/>
@@ -58,7 +59,7 @@
android:layout_height="@dimen/car_button_height"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
- android:layout_marginStart="@dimen/car_padding_4"
+ android:layout_marginEnd="@dimen/car_keyline_1"
android:ellipsize="end"
android:maxLines="1"/>
diff --git a/res/layout/suw_activity.xml b/res/layout/suw_activity.xml
index 78d688c..32f51c4 100644
--- a/res/layout/suw_activity.xml
+++ b/res/layout/suw_activity.xml
@@ -17,16 +17,12 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
- <androidx.appcompat.widget.Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="@dimen/car_app_bar_height"
- app:contentInsetStart="0dp"
- style="@style/ActionBarStyle.Car" />
+
+ <include layout="@layout/suw_action_bar_with_button"/>
+
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/src/com/android/car/settings/common/BaseFragment.java b/src/com/android/car/settings/common/BaseFragment.java
index 7d8569d..ac37a77 100644
--- a/src/com/android/car/settings/common/BaseFragment.java
+++ b/src/com/android/car/settings/common/BaseFragment.java
@@ -192,13 +192,17 @@
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
- actionBar.setDisplayHomeAsUpEnabled(false);
- actionBar.setCustomView(mActionBarLayout);
- actionBar.setDisplayShowCustomEnabled(true);
- // make the toolbar take the whole width.
- Toolbar toolbar = (Toolbar) actionBar.getCustomView().getParent();
- toolbar.setPadding(0, 0, 0, 0);
+ // Soon AppCompatActivity will no longer be used in Settings
+ if (getActivity() instanceof AppCompatActivity) {
+ ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
+ actionBar.setDisplayHomeAsUpEnabled(false);
+ actionBar.setCustomView(mActionBarLayout);
+ actionBar.setDisplayShowCustomEnabled(true);
+ // make the toolbar take the whole width.
+ Toolbar toolbar = (Toolbar) actionBar.getCustomView().getParent();
+ toolbar.setPadding(0, 0, 0, 0);
+ }
+
getActivity().findViewById(R.id.action_bar_icon_container).setOnClickListener(
v -> onBackPressed());
TextView titleView = getActivity().findViewById(R.id.title);
diff --git a/src/com/android/car/settings/security/SetupWizardScreenLockActivity.java b/src/com/android/car/settings/security/SetupWizardScreenLockActivity.java
index 7f41158..d9d016b 100644
--- a/src/com/android/car/settings/security/SetupWizardScreenLockActivity.java
+++ b/src/com/android/car/settings/security/SetupWizardScreenLockActivity.java
@@ -17,15 +17,15 @@
package com.android.car.settings.security;
import android.app.admin.DevicePolicyManager;
+import android.car.drivingstate.CarUxRestrictions;
import android.os.Bundle;
import android.os.UserHandle;
import android.text.TextUtils;
-import androidx.appcompat.widget.Toolbar;
+import androidx.fragment.app.FragmentActivity;
import com.android.car.settings.R;
import com.android.car.settings.common.BaseFragment;
-import com.android.car.settings.common.CarSettingActivity;
import com.android.car.settings.common.Logger;
import com.android.car.settingslib.util.ResultCodes;
import com.android.internal.widget.LockPatternUtils;
@@ -33,7 +33,9 @@
/**
* Entry point Activity for Setup Wizard to set screen lock.
*/
-public class SetupWizardScreenLockActivity extends CarSettingActivity implements
+public class SetupWizardScreenLockActivity extends FragmentActivity implements
+ BaseFragment.FragmentController,
+ BaseFragment.UXRestrictionsProvider,
CheckLockListener,
LockTypeDialogFragment.OnLockSelectListener {
@@ -42,6 +44,12 @@
private String mCurrLock;
private int mPasswordQuality;
+ private CarUxRestrictions mCarUxRestrictions = new CarUxRestrictions.Builder(
+ /* reqOpt= */ true,
+ CarUxRestrictions.UX_RESTRICTIONS_BASELINE,
+ /* timestamp= */ 0
+ ).build();
+
@Override
public void launchFragment(BaseFragment fragment) {
Bundle args = fragment.getArguments();
@@ -67,12 +75,17 @@
}
@Override
+ public void showDOBlockingMessage() {}
+
+ @Override
+ public CarUxRestrictions getCarUxRestrictions() {
+ return mCarUxRestrictions;
+ }
+
+ @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
setContentView(R.layout.suw_activity);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
mPasswordQuality = new LockPatternUtils(this).getKeyguardStoredPasswordQuality(
UserHandle.myUserId());