new password shouldn't be empty string

enter "Home screen backup password" in "Developer Settings",
do nothings and then click "Set backup password", There will
be a toast display "New backup password set".
The new password field cannot be empty.

Bug: https://partnerissuetracker.corp.google.com/u/2/issues/111261338
Test: empty string can not be set as a password

Signed-off-by: xiamin <xiamin@xiaomi.com>
This commit is contained in:
xiamin
2018-07-10 10:48:56 +08:00
parent 23482a54bb
commit 3c2956a08c

View File

@@ -21,6 +21,7 @@ import android.app.backup.IBackupManager;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
@@ -96,6 +97,11 @@ Log.i(TAG, "failure; password mismatch?");
}
private boolean setBackupPassword(String currentPw, String newPw) {
// new password can't be empty
if (TextUtils.isEmpty(newPw)) {
return false;
}
try {
return mBackupManager.setBackupPassword(currentPw, newPw);
} catch (RemoteException e) {