Search in sources :

Example 1 with IProgressListener

use of android.os.IProgressListener in project android_frameworks_base by ResurrectionRemix.

the class LockSettingsService method unlockUser.

private void unlockUser(int userId, byte[] token, byte[] secret) {
    // TODO: make this method fully async so we can update UI with progress strings
    final CountDownLatch latch = new CountDownLatch(1);
    final IProgressListener listener = new IProgressListener.Stub() {

        @Override
        public void onStarted(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser started");
        }

        @Override
        public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser progress " + progress);
        }

        @Override
        public void onFinished(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser finished");
            latch.countDown();
        }
    };
    try {
        ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
    } catch (RemoteException e) {
        throw e.rethrowAsRuntimeException();
    }
    try {
        latch.await(15, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    try {
        if (!mUserManager.getUserInfo(userId).isManagedProfile()) {
            final List<UserInfo> profiles = mUserManager.getProfiles(userId);
            for (UserInfo pi : profiles) {
                // Unlock managed profile with unified lock
                if (pi.isManagedProfile() && !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id) && mStorage.hasChildProfileLock(pi.id)) {
                    unlockChildProfile(pi.id);
                }
            }
        }
    } catch (RemoteException e) {
        Log.d(TAG, "Failed to unlock child profile", e);
    }
}
Also used : Bundle(android.os.Bundle) UserInfo(android.content.pm.UserInfo) CountDownLatch(java.util.concurrent.CountDownLatch) IProgressListener(android.os.IProgressListener) RemoteException(android.os.RemoteException)

Example 2 with IProgressListener

use of android.os.IProgressListener in project android_frameworks_base by DirtyUnicorns.

the class LockSettingsService method unlockUser.

private void unlockUser(int userId, byte[] token, byte[] secret) {
    // TODO: make this method fully async so we can update UI with progress strings
    final CountDownLatch latch = new CountDownLatch(1);
    final IProgressListener listener = new IProgressListener.Stub() {

        @Override
        public void onStarted(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser started");
        }

        @Override
        public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser progress " + progress);
        }

        @Override
        public void onFinished(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser finished");
            latch.countDown();
        }
    };
    try {
        ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
    } catch (RemoteException e) {
        throw e.rethrowAsRuntimeException();
    }
    try {
        latch.await(15, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    try {
        if (!mUserManager.getUserInfo(userId).isManagedProfile()) {
            final List<UserInfo> profiles = mUserManager.getProfiles(userId);
            for (UserInfo pi : profiles) {
                // Unlock managed profile with unified lock
                if (pi.isManagedProfile() && !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id) && mStorage.hasChildProfileLock(pi.id)) {
                    unlockChildProfile(pi.id);
                }
            }
        }
    } catch (RemoteException e) {
        Log.d(TAG, "Failed to unlock child profile", e);
    }
}
Also used : Bundle(android.os.Bundle) UserInfo(android.content.pm.UserInfo) CountDownLatch(java.util.concurrent.CountDownLatch) IProgressListener(android.os.IProgressListener) RemoteException(android.os.RemoteException)

Example 3 with IProgressListener

use of android.os.IProgressListener in project platform_frameworks_base by android.

the class LockSettingsService method unlockUser.

private void unlockUser(int userId, byte[] token, byte[] secret) {
    // TODO: make this method fully async so we can update UI with progress strings
    final CountDownLatch latch = new CountDownLatch(1);
    final IProgressListener listener = new IProgressListener.Stub() {

        @Override
        public void onStarted(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser started");
        }

        @Override
        public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser progress " + progress);
        }

        @Override
        public void onFinished(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser finished");
            latch.countDown();
        }
    };
    try {
        ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
    } catch (RemoteException e) {
        throw e.rethrowAsRuntimeException();
    }
    try {
        latch.await(15, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    try {
        if (!mUserManager.getUserInfo(userId).isManagedProfile()) {
            final List<UserInfo> profiles = mUserManager.getProfiles(userId);
            for (UserInfo pi : profiles) {
                // Unlock managed profile with unified lock
                if (pi.isManagedProfile() && !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id) && mStorage.hasChildProfileLock(pi.id)) {
                    unlockChildProfile(pi.id);
                }
            }
        }
    } catch (RemoteException e) {
        Log.d(TAG, "Failed to unlock child profile", e);
    }
}
Also used : Bundle(android.os.Bundle) UserInfo(android.content.pm.UserInfo) CountDownLatch(java.util.concurrent.CountDownLatch) IProgressListener(android.os.IProgressListener) RemoteException(android.os.RemoteException)

Example 4 with IProgressListener

use of android.os.IProgressListener in project android_frameworks_base by crdroidandroid.

the class LockSettingsService method unlockUser.

private void unlockUser(int userId, byte[] token, byte[] secret) {
    // TODO: make this method fully async so we can update UI with progress strings
    final CountDownLatch latch = new CountDownLatch(1);
    final IProgressListener listener = new IProgressListener.Stub() {

        @Override
        public void onStarted(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser started");
        }

        @Override
        public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser progress " + progress);
        }

        @Override
        public void onFinished(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser finished");
            latch.countDown();
        }
    };
    try {
        ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
    } catch (RemoteException e) {
        throw e.rethrowAsRuntimeException();
    }
    try {
        latch.await(15, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    try {
        if (!mUserManager.getUserInfo(userId).isManagedProfile()) {
            final List<UserInfo> profiles = mUserManager.getProfiles(userId);
            for (UserInfo pi : profiles) {
                // Unlock managed profile with unified lock
                if (pi.isManagedProfile() && !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id) && mStorage.hasChildProfileLock(pi.id)) {
                    unlockChildProfile(pi.id);
                }
            }
        }
    } catch (RemoteException e) {
        Log.d(TAG, "Failed to unlock child profile", e);
    }
}
Also used : Bundle(android.os.Bundle) UserInfo(android.content.pm.UserInfo) CountDownLatch(java.util.concurrent.CountDownLatch) IProgressListener(android.os.IProgressListener) RemoteException(android.os.RemoteException)

Example 5 with IProgressListener

use of android.os.IProgressListener in project android_frameworks_base by AOSPA.

the class LockSettingsService method unlockUser.

private void unlockUser(int userId, byte[] token, byte[] secret) {
    // TODO: make this method fully async so we can update UI with progress strings
    final CountDownLatch latch = new CountDownLatch(1);
    final IProgressListener listener = new IProgressListener.Stub() {

        @Override
        public void onStarted(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser started");
        }

        @Override
        public void onProgress(int id, int progress, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser progress " + progress);
        }

        @Override
        public void onFinished(int id, Bundle extras) throws RemoteException {
            Log.d(TAG, "unlockUser finished");
            latch.countDown();
        }
    };
    try {
        ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
    } catch (RemoteException e) {
        throw e.rethrowAsRuntimeException();
    }
    try {
        latch.await(15, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    try {
        if (!mUserManager.getUserInfo(userId).isManagedProfile()) {
            final List<UserInfo> profiles = mUserManager.getProfiles(userId);
            for (UserInfo pi : profiles) {
                // Unlock managed profile with unified lock
                if (pi.isManagedProfile() && !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id) && mStorage.hasChildProfileLock(pi.id)) {
                    unlockChildProfile(pi.id);
                }
            }
        }
    } catch (RemoteException e) {
        Log.d(TAG, "Failed to unlock child profile", e);
    }
}
Also used : Bundle(android.os.Bundle) UserInfo(android.content.pm.UserInfo) CountDownLatch(java.util.concurrent.CountDownLatch) IProgressListener(android.os.IProgressListener) RemoteException(android.os.RemoteException)

Aggregations

UserInfo (android.content.pm.UserInfo)5 Bundle (android.os.Bundle)5 IProgressListener (android.os.IProgressListener)5 RemoteException (android.os.RemoteException)5 CountDownLatch (java.util.concurrent.CountDownLatch)5