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

Commit b5e47228 authored by Adrian Roos's avatar Adrian Roos
Browse files

Add StrongAuthTracker

Bug: 22846469
Bug: 22115393
Change-Id: I6ef5322d02e540fc043e7f20d3aabf595ce7c224
parent ab45a217
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ LOCAL_SRC_FILES += \
	core/java/android/app/IWallpaperManager.aidl \
	core/java/android/app/IWallpaperManagerCallback.aidl \
	core/java/android/app/admin/IDevicePolicyManager.aidl \
	core/java/android/app/trust/IStrongAuthTracker.aidl \
	core/java/android/app/trust/ITrustManager.aidl \
	core/java/android/app/trust/ITrustListener.aidl \
	core/java/android/app/backup/IBackupManager.aidl \
+26 −0
Original line number Diff line number Diff line
/*
**
** Copyright 2015, 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 android.app.trust;

/**
 * Private API to be notified about strong auth changes
 *
 * {@hide}
 */
oneway interface IStrongAuthTracker {
    void onStrongAuthRequiredChanged(int strongAuthRequired, int userId);
}
 No newline at end of file
+0 −2
Original line number Diff line number Diff line
@@ -26,11 +26,9 @@ import android.app.trust.ITrustListener;
interface ITrustManager {
    void reportUnlockAttempt(boolean successful, int userId);
    void reportEnabledTrustAgentsChanged(int userId);
    void reportRequireCredentialEntry(int userId);
    void registerTrustListener(in ITrustListener trustListener);
    void unregisterTrustListener(in ITrustListener trustListener);
    void reportKeyguardShowingChanged();
    boolean isDeviceLocked(int userId);
    boolean isDeviceSecure(int userId);
    boolean hasUserAuthenticatedSinceBoot(int userId);
}
+6 −32
Original line number Diff line number Diff line
@@ -16,13 +16,19 @@

package android.app.trust;

import android.annotation.IntDef;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.Log;
import android.util.SparseIntArray;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * See {@link com.android.server.trust.TrustManagerService}
@@ -72,21 +78,6 @@ public class TrustManager {
        }
    }

    /**
     * Reports that trust is disabled until credentials have been entered for user {@param userId}.
     *
     * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission.
     *
     * @param userId either an explicit user id or {@link android.os.UserHandle#USER_ALL}
     */
    public void reportRequireCredentialEntry(int userId) {
        try {
            mService.reportRequireCredentialEntry(userId);
        } catch (RemoteException e) {
            onError(e);
        }
    }

    /**
     * Reports that the visibility of the keyguard has changed.
     *
@@ -147,23 +138,6 @@ public class TrustManager {
        }
    }

    /**
     * Checks whether the specified user has been authenticated since the last boot.
     *
     * @param userId the user id of the user to check for
     * @return true if the user has authenticated since boot, false otherwise
     *
     * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission.
     */
    public boolean hasUserAuthenticatedSinceBoot(int userId) {
        try {
            return mService.hasUserAuthenticatedSinceBoot(userId);
        } catch (RemoteException e) {
            onError(e);
            return false;
        }
    }

    private void onError(Exception e) {
        Log.e(TAG, "Error while calling TrustManagerService", e);
    }
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.widget;

import android.app.trust.IStrongAuthTracker;
import com.android.internal.widget.VerifyCredentialResponse;

/** {@hide} */
@@ -35,4 +36,7 @@ interface ILockSettings {
    boolean checkVoldPassword(int userId);
    boolean havePattern(int userId);
    boolean havePassword(int userId);
    void registerStrongAuthTracker(in IStrongAuthTracker tracker);
    void unregisterStrongAuthTracker(in IStrongAuthTracker tracker);
    void requireStrongAuth(int strongAuthReason, int userId);
}
Loading