diff options
| author | 2015-05-21 17:02:21 -0700 | |
|---|---|---|
| committer | 2015-05-21 17:48:59 -0700 | |
| commit | 16ef71f4f5a01158fdc07dbbd0963aa2fb04e359 (patch) | |
| tree | 2db64f6c2e4a75136943e92ed81a1dd03919e3ce | |
| parent | 770e98953e27573d24578008810eeb44c0755995 (diff) | |
Fix crash in fingerprint and problem where directory has wrong selinux label
Fixes bug 21373942
Change-Id: I860656b0c9e26c038d03d9872c490466dc62d4e7
| -rw-r--r-- | services/core/java/com/android/server/fingerprint/FingerprintService.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index 1057ce397071..fd36b7ed2d78 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -30,6 +30,7 @@ import android.os.IRemoteCallback; import android.os.Looper; import android.os.MessageQueue; import android.os.RemoteException; +import android.os.SELinux; import android.os.ServiceManager; import android.util.Slog; @@ -50,6 +51,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.NoSuchElementException; /** * A service to manage multiple clients that want to access the fingerprint HAL API. @@ -432,7 +434,12 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe public void destroy() { if (token != null) { - token.unlinkToDeath(this, 0); + try { + token.unlinkToDeath(this, 0); + } catch (NoSuchElementException e) { + // TODO: remove when duplicate call bug is found + Slog.e(TAG, "destroy(): " + this + ":", new Exception("here")); + } token = null; } receiver = null; @@ -719,6 +726,13 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe Slog.v(TAG, "Cannot make directory: " + fpDir.getAbsolutePath()); return; } + // Calling mkdir() from this process will create a directory with our + // permissions (inherited from the containing dir). This command fixes + // the label. + if (!SELinux.restorecon(fpDir)) { + Slog.w(TAG, "Restorecons failed. Directory will have wrong label."); + return; + } } daemon.setActiveGroup(userId, fpDir.getAbsolutePath().getBytes()); } catch (RemoteException e) { |