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

Commit 659936be authored by Steve Kondik's avatar Steve Kondik
Browse files

Merge branch 'gingerbread' of git://android.git.kernel.org/platform/frameworks/base into 34

Conflicts:
	core/java/android/net/ConnectivityManager.java
	core/java/android/net/NetworkStateTracker.java
	core/java/android/net/http/AndroidHttpClient.java
	core/java/android/provider/Settings.java
	core/java/com/android/internal/os/ZygoteInit.java
	core/java/com/google/android/mms/pdu/PduParser.java
	core/jni/android_net_NetUtils.cpp
	core/res/AndroidManifest.xml
	core/res/res/values-de/strings.xml
	core/res/res/values-es/strings.xml
	core/res/res/values-it/strings.xml
	core/res/res/values-pt/strings.xml
	core/res/res/values-ru/strings.xml
	core/res/res/values-uk/strings.xml
	core/res/res/values-zh-rCN/strings.xml
	core/res/res/values-zh-rTW/strings.xml
	core/res/res/values/config.xml
	core/res/res/values/strings.xml
	data/fonts/DroidSans-Bold.ttf
	data/fonts/DroidSans.ttf
	data/fonts/DroidSansArabic.ttf
	data/fonts/DroidSansMono.ttf
	data/fonts/DroidSerif-Bold.ttf
	data/fonts/DroidSerif-BoldItalic.ttf
	data/fonts/DroidSerif-Italic.ttf
	libs/ui/InputDispatcher.cpp
	packages/SystemUI/res/drawable-hdpi/stat_sys_roaming_cdma_0.png
	packages/SystemUI/res/drawable-hdpi/stat_sys_roaming_cdma_flash_anim1.png
	packages/SystemUI/res/drawable-mdpi/stat_sys_roaming_cdma_0.png
	packages/SystemUI/res/drawable-mdpi/stat_sys_roaming_cdma_flash_anim1.png
	packages/SystemUI/src/com/android/systemui/statusbar/StatusBarPolicy.java
	services/java/com/android/server/ConnectivityService.java
	services/java/com/android/server/NotificationManagerService.java
	services/java/com/android/server/UsbObserver.java
	telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java

Change-Id: I62ec21bc0b72a4a5e989f80d61f3e7a0d4ad3d3f
parents d9821c99 f0f1ceeb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ LOCAL_SRC_FILES += \
	core/java/android/content/pm/IPackageMoveObserver.aidl \
	core/java/android/content/pm/IPackageStatsObserver.aidl \
	core/java/android/database/IContentObserver.aidl \
	core/java/android/hardware/usb/IUsbManager.aidl \
	core/java/android/net/IConnectivityManager.aidl \
	core/java/android/net/INetworkManagementEventObserver.aidl \
	core/java/android/net/IThrottleManager.aidl \
@@ -122,10 +123,10 @@ LOCAL_SRC_FILES += \
	core/java/android/nfc/ILlcpServiceSocket.aidl \
	core/java/android/nfc/ILlcpSocket.aidl \
	core/java/android/nfc/INfcAdapter.aidl \
	core/java/android/nfc/INfcAdapterExtras.aidl \
	core/java/android/nfc/INfcTag.aidl \
	core/java/android/nfc/IP2pInitiator.aidl \
	core/java/android/nfc/IP2pTarget.aidl \
    core/java/android/nfc/INfcSecureElement.aidl \
	core/java/android/os/IHardwareService.aidl \
	core/java/android/os/IMessenger.aidl \
	core/java/android/os/INetworkManagementService.aidl \
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/androi
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/trustedlogic)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/com/trustedlogic)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc/INdefTag.java)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc)

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+36 −2
Original line number Diff line number Diff line
@@ -18,17 +18,22 @@ package android.accounts;

import android.content.pm.PackageManager;
import android.content.pm.RegisteredServicesCache;
import android.content.pm.ResolveInfo;
import android.content.pm.XmlSerializerAndParser;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.util.Log;
import android.text.TextUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlSerializer;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.util.List;

/**
 * A cache of services that export the {@link IAccountAuthenticator} interface. This cache
@@ -63,11 +68,40 @@ import java.io.IOException;
                    com.android.internal.R.styleable.AccountAuthenticator_smallIcon, 0);
            final int prefId = sa.getResourceId(
                    com.android.internal.R.styleable.AccountAuthenticator_accountPreferences, 0);
            
            boolean customTokens = false;
            try {
                // In HC this will be an attribute in authenticator.xml, this is a workaround
                // using meta-data to avoid changes to the API. 
                // If meta-data is absent the old behavior is preserved. 
                // Authenticator will know if AccountManager supports customTokens or not.
                PackageManager pm = mContext.getPackageManager();
                List<ResolveInfo> resolveInfos = pm.queryIntentServices(
                        new Intent(AccountManager.ACTION_AUTHENTICATOR_INTENT),
                        PackageManager.GET_META_DATA);
                for (ResolveInfo resolveInfo: resolveInfos) {
                    android.content.pm.ServiceInfo si = resolveInfo.serviceInfo;
                    if (!packageName.equals(si.packageName)) {
                        continue;
                    }
                    Object ctString = si.metaData.get(AccountManager.ACTION_AUTHENTICATOR_INTENT 
                            + ".customTokens");
                    if (ctString != null) {
                        customTokens = true;
                    }
                }
            } catch (Throwable t) {
                // Protected against invalid data in meta or unexpected 
                // conditions - the authenticator will not have the new 
                // features. 
                Log.e(TAG, "Error getting customTokens metadata " + t);
            }
            
            if (TextUtils.isEmpty(accountType)) {
                return null;
            }
            return new AuthenticatorDescription(accountType, packageName, labelId, iconId,
                    smallIconId, prefId);
                    smallIconId, prefId, customTokens);
        } finally {
            sa.recycle();
        }
+18 −0
Original line number Diff line number Diff line
@@ -188,6 +188,24 @@ public class AccountManager {
    public static final String KEY_ERROR_CODE = "errorCode";
    public static final String KEY_ERROR_MESSAGE = "errorMessage";
    public static final String KEY_USERDATA = "userdata";
    /**
     * Authenticators using 'customTokens' option will also get the UID of the
     * caller
     * @hide
     */
    public static final String KEY_CALLER_UID = "callerUid";

    /**
     * @hide 
     */
    public static final String KEY_CALLER_PID = "callerPid";

    /**
     * Boolean, if set and 'customTokens' the authenticator is responsible for
     * notifications.
     * @hide
     */
    public static final String KEY_NOTIFY_ON_FAILURE = "notifyOnAuthFailure";

    public static final String ACTION_AUTHENTICATOR_INTENT =
            "android.accounts.AccountAuthenticator";
+63 −103
Original line number Diff line number Diff line
@@ -91,6 +91,8 @@ public class AccountManagerService

    private final Context mContext;

    private final PackageManager mPackageManager;

    private HandlerThread mMessageThread;
    private final MessageHandler mMessageHandler;

@@ -99,7 +101,6 @@ public class AccountManagerService

    private final AccountAuthenticatorCache mAuthenticatorCache;
    private final DatabaseHelper mOpenHelper;
    private final SimWatcher mSimWatcher;

    private static final String TABLE_ACCOUNTS = "accounts";
    private static final String ACCOUNTS_ID = "_id";
@@ -214,6 +215,7 @@ public class AccountManagerService

    public AccountManagerService(Context context) {
        mContext = context;
        mPackageManager = context.getPackageManager();

        mOpenHelper = new DatabaseHelper(mContext);

@@ -224,7 +226,6 @@ public class AccountManagerService
        mAuthenticatorCache = new AccountAuthenticatorCache(mContext);
        mAuthenticatorCache.setListener(this, null /* Handler */);

        mSimWatcher = new SimWatcher(mContext);
        sThis.set(this);

        validateAccounts();
@@ -520,6 +521,18 @@ public class AccountManagerService
        if (account == null) throw new IllegalArgumentException("account is null");
        checkManageAccountsPermission();
        long identityToken = clearCallingIdentity();

        cancelNotification(getSigninRequiredNotificationId(account));
        synchronized(mCredentialsPermissionNotificationIds) {
            for (Pair<Pair<Account, String>, Integer> pair:
                mCredentialsPermissionNotificationIds.keySet()) {
                if (account.equals(pair.first.first)) {
                    int id = mCredentialsPermissionNotificationIds.get(pair);
                    cancelNotification(id);
                }
            }
        }

        try {
            new RemoveAccountSession(response, account).bind();
        } finally {
@@ -842,19 +855,49 @@ public class AccountManagerService

    public void getAuthToken(IAccountManagerResponse response, final Account account,
            final String authTokenType, final boolean notifyOnAuthFailure,
            final boolean expectActivityLaunch, final Bundle loginOptions) {
            final boolean expectActivityLaunch, Bundle loginOptionsIn) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "getAuthToken: " + account
                    + ", response " + response
                    + ", authTokenType " + authTokenType
                    + ", notifyOnAuthFailure " + notifyOnAuthFailure
                    + ", expectActivityLaunch " + expectActivityLaunch
                    + ", caller's uid " + Binder.getCallingUid()
                    + ", pid " + Binder.getCallingPid());
        }
        if (response == null) throw new IllegalArgumentException("response is null");
        if (account == null) throw new IllegalArgumentException("account is null");
        if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
        checkBinderPermission(Manifest.permission.USE_CREDENTIALS);
        final int callerUid = Binder.getCallingUid();
        final boolean permissionGranted = permissionIsGranted(account, authTokenType, callerUid);
        final int callerPid = Binder.getCallingPid();

        AccountAuthenticatorCache.ServiceInfo<AuthenticatorDescription> authenticatorInfo =
            mAuthenticatorCache.getServiceInfo(
                    AuthenticatorDescription.newKey(account.type));
        final boolean customTokens =
            authenticatorInfo != null && authenticatorInfo.type.customTokens;

        // skip the check if customTokens
        final boolean permissionGranted = customTokens ||
            permissionIsGranted(account, authTokenType, callerUid);

        final Bundle loginOptions = (loginOptionsIn == null) ? new Bundle() :
            loginOptionsIn;
        if (customTokens) {
            // let authenticator know the identity of the caller
            loginOptions.putInt(AccountManager.KEY_CALLER_UID, callerUid);
            loginOptions.putInt(AccountManager.KEY_CALLER_PID, callerPid);
            if (notifyOnAuthFailure) {
                loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true);
            }
        }

        long identityToken = clearCallingIdentity();
        try {
            // if the caller has permission, do the peek. otherwise go the more expensive
            // route of starting a Session
            if (permissionGranted) {
            if (!customTokens && permissionGranted) {
                String authToken = readAuthTokenFromDatabase(account, authTokenType);
                if (authToken != null) {
                    Bundle result = new Bundle();
@@ -908,12 +951,14 @@ public class AccountManagerService
                                        "the type and name should not be empty");
                                return;
                            }
                            if (!customTokens) {
                                saveAuthTokenToDatabase(new Account(name, type),
                                        authTokenType, authToken);
                            }
                        }

                        Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
                        if (intent != null && notifyOnAuthFailure) {
                        if (intent != null && notifyOnAuthFailure && !customTokens) {
                            doNotification(
                                    account, result.getString(AccountManager.KEY_AUTH_FAILED_MESSAGE),
                                    intent);
@@ -972,6 +1017,10 @@ public class AccountManagerService
            AccountAuthenticatorResponse response, String authTokenType, String authTokenLabel) {

        Intent intent = new Intent(mContext, GrantCredentialsPermissionActivity.class);
        // See FLAG_ACTIVITY_NEW_TASK docs for limitations and benefits of the flag.
        // Since it was set in Eclair+ we can't change it without breaking apps using
        // the intent from a non-Activity context.
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addCategory(
                String.valueOf(getCredentialPermissionNotificationId(account, authTokenType, uid)));

@@ -1640,95 +1689,6 @@ public class AccountManagerService
        }
    }

    private class SimWatcher extends BroadcastReceiver {
        public SimWatcher(Context context) {
            // Re-scan the SIM card when the SIM state changes, and also if
            // the disk recovers from a full state (we may have failed to handle
            // things properly while the disk was full).
            final IntentFilter filter = new IntentFilter();
            filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
            filter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
            context.registerReceiver(this, filter);
        }

        /**
         * Compare the IMSI to the one stored in the login service's
         * database.  If they differ, erase all passwords and
         * authtokens (and store the new IMSI).
         */
        @Override
        public void onReceive(Context context, Intent intent) {
            // Check IMSI on every update; nothing happens if the IMSI
            // is missing or unchanged.
            TelephonyManager telephonyManager =
                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            if (telephonyManager == null) {
                Log.w(TAG, "failed to get TelephonyManager");
                return;
            }
            String imsi = telephonyManager.getSubscriberId();

            // If the subscriber ID is an empty string, don't do anything.
            if (TextUtils.isEmpty(imsi)) return;

            // If the current IMSI matches what's stored, don't do anything.
            String storedImsi = getMetaValue("imsi");
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "current IMSI=" + imsi + "; stored IMSI=" + storedImsi);
            }
            if (imsi.equals(storedImsi)) return;

            // If a CDMA phone is unprovisioned, getSubscriberId()
            // will return a different value, but we *don't* erase the
            // passwords.  We only erase them if it has a different
            // subscriber ID once it's provisioned.
            if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
                IBinder service = ServiceManager.checkService(Context.TELEPHONY_SERVICE);
                if (service == null) {
                    Log.w(TAG, "call to checkService(TELEPHONY_SERVICE) failed");
                    return;
                }
                ITelephony telephony = ITelephony.Stub.asInterface(service);
                if (telephony == null) {
                    Log.w(TAG, "failed to get ITelephony interface");
                    return;
                }
                boolean needsProvisioning;
                try {
                    needsProvisioning = telephony.getCdmaNeedsProvisioning();
                } catch (RemoteException e) {
                    Log.w(TAG, "exception while checking provisioning", e);
                    // default to NOT wiping out the passwords
                    needsProvisioning = true;
                }
                if (needsProvisioning) {
                    // if the phone needs re-provisioning, don't do anything.
                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
                        Log.v(TAG, "current IMSI=" + imsi + " (needs provisioning); stored IMSI=" +
                              storedImsi);
                    }
                    return;
                }
            }

            if (!imsi.equals(storedImsi) && !TextUtils.isEmpty(storedImsi)) {
                Log.w(TAG, "wiping all passwords and authtokens because IMSI changed ("
                        + "stored=" + storedImsi + ", current=" + imsi + ")");
                SQLiteDatabase db = mOpenHelper.getWritableDatabase();
                db.beginTransaction();
                try {
                    db.execSQL("DELETE from " + TABLE_AUTHTOKENS);
                    db.execSQL("UPDATE " + TABLE_ACCOUNTS + " SET " + ACCOUNTS_PASSWORD + " = ''");
                    sendAccountsChangedBroadcast();
                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                }
            }
            setMetaValue("imsi", imsi);
        }
    }

    public IBinder onBind(Intent intent) {
        return asBinder();
    }
@@ -1849,12 +1809,12 @@ public class AccountManagerService
    }

    private boolean inSystemImage(int callerUid) {
        String[] packages = mContext.getPackageManager().getPackagesForUid(callerUid);
        String[] packages = mPackageManager.getPackagesForUid(callerUid);
        for (String name : packages) {
            try {
                PackageInfo packageInfo =
                        mContext.getPackageManager().getPackageInfo(name, 0 /* flags */);
                if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                PackageInfo packageInfo = mPackageManager.getPackageInfo(name, 0 /* flags */);
                if (packageInfo != null
                        && (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                    return true;
                }
            } catch (PackageManager.NameNotFoundException e) {
@@ -1872,7 +1832,7 @@ public class AccountManagerService
                && hasExplicitlyGrantedPermission(account, authTokenType);
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "checkGrantsOrCallingUidAgainstAuthenticator: caller uid "
                    + callerUid + ", account " + account
                    + callerUid + ", " + account
                    + ": is authenticator? " + fromAuthenticator
                    + ", has explicit permission? " + hasExplicitGrants);
        }
@@ -1884,7 +1844,7 @@ public class AccountManagerService
                mAuthenticatorCache.getAllServices()) {
            if (serviceInfo.type.type.equals(accountType)) {
                return (serviceInfo.uid == callingUid) ||
                        (mContext.getPackageManager().checkSignatures(serviceInfo.uid, callingUid)
                        (mPackageManager.checkSignatures(serviceInfo.uid, callingUid)
                                == PackageManager.SIGNATURE_MATCH);
            }
        }
Loading