Consolidated the many variants of ChooseLock*.createIntent, so that it will take the same set of arguments. Also modified SetupChooseLock*.createIntent to modifyIntentForSetup, which will take the intent created by ChooseLock* and modify it for use with setup. Test: cd tests/robotests && mma Change-Id: I5ff033f459c33ec9980872a536b3996d89f2bbbb
67 lines
2.5 KiB
Java
67 lines
2.5 KiB
Java
/*
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.settings.password;
|
|
|
|
import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PARENT_PROFILE_PASSWORD;
|
|
import static android.app.admin.DevicePolicyManager.ACTION_SET_NEW_PASSWORD;
|
|
|
|
import android.app.Activity;
|
|
import android.app.admin.DevicePolicyManager;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
|
|
import com.android.settings.Utils;
|
|
|
|
/**
|
|
* Trampolines {@link DevicePolicyManager#ACTION_SET_NEW_PASSWORD} and
|
|
* {@link DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD} intent to the appropriate UI
|
|
* activity for handling set new password.
|
|
*/
|
|
public class SetNewPasswordActivity extends Activity implements SetNewPasswordController.Ui {
|
|
private static final String TAG = "SetNewPasswordActivity";
|
|
private String mNewPasswordAction;
|
|
private SetNewPasswordController mSetNewPasswordController;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedState) {
|
|
super.onCreate(savedState);
|
|
|
|
mNewPasswordAction = getIntent().getAction();
|
|
if (!ACTION_SET_NEW_PASSWORD.equals(mNewPasswordAction)
|
|
&& !ACTION_SET_NEW_PARENT_PROFILE_PASSWORD.equals(mNewPasswordAction)) {
|
|
Log.e(TAG, "Unexpected action to launch this activity");
|
|
finish();
|
|
return;
|
|
}
|
|
mSetNewPasswordController = SetNewPasswordController.create(
|
|
this, this, getIntent(), getActivityToken());
|
|
mSetNewPasswordController.dispatchSetNewPasswordIntent();
|
|
}
|
|
|
|
@Override
|
|
public void launchChooseLock(Bundle chooseLockFingerprintExtras) {
|
|
final boolean isInSetupWizard = !Utils.isDeviceProvisioned(this);
|
|
Intent intent = isInSetupWizard ? new Intent(this, SetupChooseLockGeneric.class)
|
|
: new Intent(this, ChooseLockGeneric.class);
|
|
intent.setAction(mNewPasswordAction);
|
|
intent.putExtras(chooseLockFingerprintExtras);
|
|
startActivity(intent);
|
|
finish();
|
|
}
|
|
}
|