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

Commit 1125d780 authored by Jason parks's avatar Jason parks
Browse files

Remove the APIs for the old encryption scheme.

Change-Id: I55116a5b29b10dfd50015805ec019b485257f68b
parent 688b0af6
Loading
Loading
Loading
Loading
+26 −10
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Binder;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -52,13 +51,11 @@ import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;

import java.io.File;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -453,6 +450,7 @@ public class AccountManagerService
            mAccount = account;
        }

        @Override
        public void run() throws RemoteException {
            try {
                mAuthenticator.hasFeatures(this, mAccount, mFeatures);
@@ -461,6 +459,7 @@ public class AccountManagerService
            }
        }

        @Override
        public void onResult(Bundle result) {
            IAccountManagerResponse response = getResponseAndClose();
            if (response != null) {
@@ -486,6 +485,7 @@ public class AccountManagerService
            }
        }

        @Override
        protected String toDebugString(long now) {
            return super.toDebugString(now) + ", hasFeatures"
                    + ", " + mAccount
@@ -531,15 +531,18 @@ public class AccountManagerService
            mAccount = account;
        }

        @Override
        protected String toDebugString(long now) {
            return super.toDebugString(now) + ", removeAccount"
                    + ", account " + mAccount;
        }

        @Override
        public void run() throws RemoteException {
            mAuthenticator.getAccountRemovalAllowed(this, mAccount);
        }

        @Override
        public void onResult(Bundle result) {
            if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT)
                    && !result.containsKey(AccountManager.KEY_INTENT)) {
@@ -832,16 +835,19 @@ public class AccountManagerService
        try {
            new Session(response, account.type, false,
                    false /* stripAuthTokenFromResult */) {
                @Override
                protected String toDebugString(long now) {
                    return super.toDebugString(now) + ", getAuthTokenLabel"
                            + ", " + account
                            + ", authTokenType " + authTokenType;
                }

                @Override
                public void run() throws RemoteException {
                    mAuthenticator.getAuthTokenLabel(this, authTokenType);
                }

                @Override
                public void onResult(Bundle result) {
                    if (result != null) {
                        String label = result.getString(AccountManager.KEY_AUTH_TOKEN_LABEL);
@@ -912,6 +918,7 @@ public class AccountManagerService

            new Session(response, account.type, expectActivityLaunch,
                    false /* stripAuthTokenFromResult */) {
                @Override
                protected String toDebugString(long now) {
                    if (loginOptions != null) loginOptions.keySet();
                    return super.toDebugString(now) + ", getAuthToken"
@@ -921,6 +928,7 @@ public class AccountManagerService
                            + ", notifyOnAuthFailure " + notifyOnAuthFailure;
                }

                @Override
                public void run() throws RemoteException {
                    // If the caller doesn't have permission then create and return the
                    // "grant permission" intent instead of the "getAuthToken" intent.
@@ -931,6 +939,7 @@ public class AccountManagerService
                    }
                }

                @Override
                public void onResult(Bundle result) {
                    if (result != null) {
                        if (result.containsKey(AccountManager.KEY_AUTH_TOKEN_LABEL)) {
@@ -1075,11 +1084,13 @@ public class AccountManagerService
        try {
            new Session(response, accountType, expectActivityLaunch,
                    true /* stripAuthTokenFromResult */) {
                @Override
                public void run() throws RemoteException {
                    mAuthenticator.addAccount(this, mAccountType, authTokenType, requiredFeatures,
                            options);
                }

                @Override
                protected String toDebugString(long now) {
                    return super.toDebugString(now) + ", addAccount"
                            + ", accountType " + accountType
@@ -1110,9 +1121,11 @@ public class AccountManagerService
        try {
            new Session(response, account.type, expectActivityLaunch,
                    true /* stripAuthTokenFromResult */) {
                @Override
                public void run() throws RemoteException {
                    mAuthenticator.confirmCredentials(this, account, options);
                }
                @Override
                protected String toDebugString(long now) {
                    return super.toDebugString(now) + ", confirmCredentials"
                            + ", " + account;
@@ -1142,9 +1155,11 @@ public class AccountManagerService
        try {
            new Session(response, account.type, expectActivityLaunch,
                    true /* stripAuthTokenFromResult */) {
                @Override
                public void run() throws RemoteException {
                    mAuthenticator.updateCredentials(this, account, authTokenType, loginOptions);
                }
                @Override
                protected String toDebugString(long now) {
                    if (loginOptions != null) loginOptions.keySet();
                    return super.toDebugString(now) + ", updateCredentials"
@@ -1174,9 +1189,11 @@ public class AccountManagerService
        try {
            new Session(response, accountType, expectActivityLaunch,
                    true /* stripAuthTokenFromResult */) {
                @Override
                public void run() throws RemoteException {
                    mAuthenticator.editProperties(this, mAccountType);
                }
                @Override
                protected String toDebugString(long now) {
                    return super.toDebugString(now) + ", editProperties"
                            + ", accountType " + accountType;
@@ -1200,6 +1217,7 @@ public class AccountManagerService
            mFeatures = features;
        }

        @Override
        public void run() throws RemoteException {
            mAccountsOfType = getAccountsByTypeFromCache(mAccountType);
            // check whether each account matches the requested features
@@ -1234,6 +1252,7 @@ public class AccountManagerService
            }
        }

        @Override
        public void onResult(Bundle result) {
            mNumResults++;
            if (result == null) {
@@ -1272,6 +1291,7 @@ public class AccountManagerService
        }


        @Override
        protected String toDebugString(long now) {
            return super.toDebugString(now) + ", getAccountsByTypeAndFeatures"
                    + ", " + (mFeatures != null ? TextUtils.join(",", mFeatures) : null);
@@ -1594,6 +1614,7 @@ public class AccountManagerService
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MESSAGE_TIMED_OUT:
@@ -1608,14 +1629,8 @@ public class AccountManagerService
    }

    private static String getDatabaseName() {
        if(Environment.isEncryptedFilesystemEnabled()) {
            // Hard-coded path in case of encrypted file system
            return Environment.getSystemSecureDirectory().getPath() + File.separator + DATABASE_NAME;
        } else {
            // Regular path in case of non-encrypted file system
        return DATABASE_NAME;
    }
    }

    private class DatabaseHelper extends SQLiteOpenHelper {

@@ -1837,6 +1852,7 @@ public class AccountManagerService
        return false;
    }

    @Override
    protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
        final boolean isCheckinRequest = scanArgs(args, "--checkin") || scanArgs(args, "-c");

+7 −7
Original line number Diff line number Diff line
@@ -20,10 +20,6 @@ import com.android.internal.os.AtomicFile;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastXmlSerializer;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

import android.accounts.Account;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@@ -37,9 +33,9 @@ import android.os.Parcel;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
import android.util.Xml;
import android.util.Pair;

import java.io.File;
import java.io.FileInputStream;
@@ -48,8 +44,12 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.TimeZone;
import java.util.List;
import java.util.TimeZone;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

/**
 * Singleton that tracks the sync data and overall sync
@@ -319,7 +319,7 @@ public class SyncStorageEngine extends Handler {
        }
        // This call will return the correct directory whether Encrypted File Systems is
        // enabled or not.
        File dataDir = Environment.getSecureDataDirectory();
        File dataDir = Environment.getDataDirectory();
        sSyncStorageEngine = new SyncStorageEngine(context, dataDir);
    }

+2 −10
Original line number Diff line number Diff line
@@ -269,16 +269,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
    
    /**
     * Value for {@link #flags}: this is true if the application has set
     * its android:neverEncrypt to true, false otherwise. It is used to specify
     * that this package specifically "opts-out" of a secured file system solution,
     * and will always store its data in-the-clear.
     *
     * {@hide}
     */
    public static final int FLAG_NEVER_ENCRYPT = 1<<30;

    /**
     * Value for {@link #flags}: Set to true if the application has been
     * installed using the forward lock option.
@@ -469,6 +459,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    }


    @Override
    public String toString() {
        return "ApplicationInfo{"
            + Integer.toHexString(System.identityHashCode(this))
@@ -479,6 +470,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int parcelableFlags) {
        super.writeToParcel(dest, parcelableFlags);
        dest.writeString(taskAffinity);
+20 −9
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.content.pm;

import com.android.internal.util.XmlUtils;

import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentFilter;
@@ -32,9 +34,6 @@ import android.util.Config;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import com.android.internal.util.XmlUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.BufferedInputStream;
import java.io.File;
@@ -49,6 +48,9 @@ import java.util.Iterator;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/**
 * Package archive parsing
 *
@@ -1573,12 +1575,6 @@ public class PackageParser {
            ai.flags |= ApplicationInfo.FLAG_TEST_ONLY;
        }

        if (sa.getBoolean(
                com.android.internal.R.styleable.AndroidManifestApplication_neverEncrypt,
                false)) {
            ai.flags |= ApplicationInfo.FLAG_NEVER_ENCRYPT;
        }

        String str;
        str = sa.getNonConfigurationString(
                com.android.internal.R.styleable.AndroidManifestApplication_permission, 0);
@@ -2869,6 +2865,7 @@ public class PackageParser {
            }
        }
        
        @Override
        public String toString() {
            return "Package{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3009,11 +3006,13 @@ public class PackageParser {
            info = _info;
        }
        
        @Override
        public void setPackageName(String packageName) {
            super.setPackageName(packageName);
            info.packageName = packageName;
        }

        @Override
        public String toString() {
            return "Permission{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3034,11 +3033,13 @@ public class PackageParser {
            info = _info;
        }

        @Override
        public void setPackageName(String packageName) {
            super.setPackageName(packageName);
            info.packageName = packageName;
        }

        @Override
        public String toString() {
            return "PermissionGroup{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3125,11 +3126,13 @@ public class PackageParser {
            info.applicationInfo = args.owner.applicationInfo;
        }
        
        @Override
        public void setPackageName(String packageName) {
            super.setPackageName(packageName);
            info.packageName = packageName;
        }

        @Override
        public String toString() {
            return "Activity{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3159,11 +3162,13 @@ public class PackageParser {
            info.applicationInfo = args.owner.applicationInfo;
        }
        
        @Override
        public void setPackageName(String packageName) {
            super.setPackageName(packageName);
            info.packageName = packageName;
        }

        @Override
        public String toString() {
            return "Service{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3200,11 +3205,13 @@ public class PackageParser {
            this.syncable = existingProvider.syncable;
        }

        @Override
        public void setPackageName(String packageName) {
            super.setPackageName(packageName);
            info.packageName = packageName;
        }

        @Override
        public String toString() {
            return "Provider{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3238,11 +3245,13 @@ public class PackageParser {
            info = _info;
        }
        
        @Override
        public void setPackageName(String packageName) {
            super.setPackageName(packageName);
            info.packageName = packageName;
        }

        @Override
        public String toString() {
            return "Instrumentation{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3276,6 +3285,7 @@ public class PackageParser {
            activity = _activity;
        }

        @Override
        public String toString() {
            return "ActivityIntentInfo{"
                + Integer.toHexString(System.identityHashCode(this))
@@ -3290,6 +3300,7 @@ public class PackageParser {
            service = _service;
        }

        @Override
        public String toString() {
            return "ServiceIntentInfo{"
                + Integer.toHexString(System.identityHashCode(this))
+2 −42
Original line number Diff line number Diff line
@@ -16,11 +16,11 @@

package android.os;

import java.io.File;

import android.content.res.Resources;
import android.os.storage.IMountService;

import java.io.File;

/**
 * Provides access to environment variables.
 */
@@ -47,46 +47,6 @@ public class Environment {
        return ROOT_DIRECTORY;
    }

    /**
     * Gets the system directory available for secure storage.
     * If Encrypted File system is enabled, it returns an encrypted directory (/data/secure/system).
     * Otherwise, it returns the unencrypted /data/system directory.
     * @return File object representing the secure storage system directory.
     * @hide
     */
    public static File getSystemSecureDirectory() {
        if (isEncryptedFilesystemEnabled()) {
            return new File(SECURE_DATA_DIRECTORY, "system");
        } else {
            return new File(DATA_DIRECTORY, "system");
        }
    }

    /**
     * Gets the data directory for secure storage.
     * If Encrypted File system is enabled, it returns an encrypted directory (/data/secure).
     * Otherwise, it returns the unencrypted /data directory.
     * @return File object representing the data directory for secure storage.
     * @hide
     */
    public static File getSecureDataDirectory() {
        if (isEncryptedFilesystemEnabled()) {
            return SECURE_DATA_DIRECTORY;
        } else {
            return DATA_DIRECTORY;
        }
    }

    /**
     * Returns whether the Encrypted File System feature is enabled on the device or not.
     * @return <code>true</code> if Encrypted File System feature is enabled, <code>false</code>
     * if disabled.
     * @hide
     */
    public static boolean isEncryptedFilesystemEnabled() {
        return SystemProperties.getBoolean(SYSTEM_PROPERTY_EFS_ENABLED, false);
    }

    private static final File DATA_DIRECTORY
            = getDirectory("ANDROID_DATA", "/data");

Loading