Example usage for android.util Slog e

List of usage examples for android.util Slog e

Introduction

In this page you can find the example usage for android.util Slog e.

Prototype

@UnsupportedAppUsage
    public static int e(String tag, String msg) 

Source Link

Usage

From source file:com.android.server.MountService.java

@Override
public String getPassword() throws RemoteException {
    if (!isReady()) {
        return new String();
    }/*from   w  ww.j a v a 2  s . com*/

    final NativeDaemonEvent event;
    try {
        event = mConnector.execute("cryptfs", "getpw");
        if ("-1".equals(event.getMessage())) {
            // -1 equals no password
            return null;
        }
        return fromHex(event.getMessage());
    } catch (NativeDaemonConnectorException e) {
        throw e.rethrowAsParcelableException();
    } catch (IllegalArgumentException e) {
        Slog.e(TAG, "Invalid response to getPassword");
        return null;
    }
}

From source file:com.android.server.MountService.java

@Override
public int mkdirs(String callingPkg, String appPath) {
    final int userId = UserHandle.getUserId(Binder.getCallingUid());
    final UserEnvironment userEnv = new UserEnvironment(userId);

    // Validate that reported package name belongs to caller
    final AppOpsManager appOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
    appOps.checkPackage(Binder.getCallingUid(), callingPkg);

    try {/*from w  ww  . ja v  a  2  s. c  o  m*/
        appPath = new File(appPath).getCanonicalPath();
    } catch (IOException e) {
        Slog.e(TAG, "Failed to resolve " + appPath + ": " + e);
        return -1;
    }

    if (!appPath.endsWith("/")) {
        appPath = appPath + "/";
    }

    // Try translating the app path into a vold path, but require that it
    // belong to the calling package.
    String voldPath = maybeTranslatePathForVold(appPath, userEnv.buildExternalStorageAppDataDirs(callingPkg),
            userEnv.buildExternalStorageAppDataDirsForVold(callingPkg));
    if (voldPath != null) {
        try {
            mConnector.execute("volume", "mkdirs", voldPath);
            return 0;
        } catch (NativeDaemonConnectorException e) {
            return e.getCode();
        }
    }

    voldPath = maybeTranslatePathForVold(appPath, userEnv.buildExternalStorageAppObbDirs(callingPkg),
            userEnv.buildExternalStorageAppObbDirsForVold(callingPkg));
    if (voldPath != null) {
        try {
            mConnector.execute("volume", "mkdirs", voldPath);
            return 0;
        } catch (NativeDaemonConnectorException e) {
            return e.getCode();
        }
    }

    voldPath = maybeTranslatePathForVold(appPath, userEnv.buildExternalStorageAppMediaDirs(callingPkg),
            userEnv.buildExternalStorageAppMediaDirsForVold(callingPkg));
    if (voldPath != null) {
        try {
            mConnector.execute("volume", "mkdirs", voldPath);
            return 0;
        } catch (NativeDaemonConnectorException e) {
            return e.getCode();
        }
    }

    throw new SecurityException("Invalid mkdirs path: " + appPath);
}