1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.password; 18 19 import android.app.Activity; 20 import android.content.Intent; 21 import android.os.Bundle; 22 import android.os.UserHandle; 23 import android.os.UserManager; 24 import android.util.Log; 25 26 import com.android.settings.R; 27 28 import com.google.android.setupcompat.template.FooterBarMixin; 29 import com.google.android.setupcompat.template.FooterButton; 30 import com.google.android.setupdesign.GlifLayout; 31 32 /** 33 * An activity that asks the user to contact their admin to get assistance with forgotten password. 34 */ 35 public class ForgotPasswordActivity extends Activity { 36 public static final String TAG = ForgotPasswordActivity.class.getSimpleName(); 37 @Override onCreate(Bundle savedInstanceState)38 protected void onCreate(Bundle savedInstanceState) { 39 super.onCreate(savedInstanceState); 40 int userId = getIntent().getIntExtra(Intent.EXTRA_USER_ID, -1); 41 if (userId < 0) { 42 Log.e(TAG, "No valid userId supplied, exiting"); 43 finish(); 44 return; 45 } 46 setContentView(R.layout.forgot_password_activity); 47 48 final GlifLayout layout = findViewById(R.id.setup_wizard_layout); 49 layout.getMixin(FooterBarMixin.class).setPrimaryButton( 50 new FooterButton.Builder(this) 51 .setText(android.R.string.ok) 52 .setListener(v -> finish()) 53 .setButtonType(FooterButton.ButtonType.DONE) 54 .setTheme(R.style.SudGlifButton_Primary) 55 .build() 56 ); 57 58 UserManager.get(this).requestQuietModeEnabled( 59 false, UserHandle.of(userId), UserManager.QUIET_MODE_DISABLE_DONT_ASK_CREDENTIAL); 60 } 61 } 62