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

Commit 0d60086e authored by Paul Lawrence's avatar Paul Lawrence Committed by Android Git Automerger
Browse files

am 433d70d3: am 7c4b9413: am 56a38862: Merge "Fix pause when setting...

am 433d70d3: am 7c4b9413: am 56a38862: Merge "Fix pause when setting pin/pattern/password" into lmp-dev

* commit '433d70d348a21a9f2f15c5357a14c3955b751915':
  Fix pause when setting pin/pattern/password
parents 7d7e3940 994ba63f
Loading
Loading
Loading
Loading
+15 −8
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.content.pm.UserInfo;
import android.os.AsyncTask;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
@@ -718,25 +719,31 @@ public class LockPatternUtils {
    }
    }


    /** Update the encryption password if it is enabled **/
    /** Update the encryption password if it is enabled **/
    private void updateEncryptionPassword(int type, String password) {
    private void updateEncryptionPassword(final int type, final String password) {
        DevicePolicyManager dpm = getDevicePolicyManager();
        DevicePolicyManager dpm = getDevicePolicyManager();
        if (dpm.getStorageEncryptionStatus(getCurrentOrCallingUserId())
        if (dpm.getStorageEncryptionStatus(getCurrentOrCallingUserId())
                != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) {
                != DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE) {
            return;
            return;
        }
        }


        IBinder service = ServiceManager.getService("mount");
        final IBinder service = ServiceManager.getService("mount");
        if (service == null) {
        if (service == null) {
            Log.e(TAG, "Could not find the mount service to update the encryption password");
            Log.e(TAG, "Could not find the mount service to update the encryption password");
            return;
            return;
        }
        }


        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... dummy) {
                IMountService mountService = IMountService.Stub.asInterface(service);
                IMountService mountService = IMountService.Stub.asInterface(service);
                try {
                try {
                    mountService.changeEncryptionPassword(type, password);
                    mountService.changeEncryptionPassword(type, password);
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    Log.e(TAG, "Error changing encryption password", e);
                    Log.e(TAG, "Error changing encryption password", e);
                }
                }
                return null;
            }
        }.execute();
    }
    }


    /**
    /**