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

Commit 86386c8e authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Theme some more framework notifications." into gingerbread

parents 50dbea6a a3a1a321
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import com.android.internal.R;
import com.android.internal.app.ThemeUtils;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.TelephonyIntents;

@@ -90,6 +91,7 @@ public class AccountManagerService
    private static final int DATABASE_VERSION = 4;

    private final Context mContext;
    private Context mUiContext;

    private final PackageManager mPackageManager;

@@ -155,6 +157,12 @@ public class AccountManagerService
    private static AtomicReference<AccountManagerService> sThis =
            new AtomicReference<AccountManagerService>();

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
        }
    };

    private static final boolean isDebuggableMonkeyBuild =
            SystemProperties.getBoolean("ro.monkey", false);
    private static final Account[] EMPTY_ACCOUNT_ARRAY = new Account[]{};
@@ -226,6 +234,8 @@ public class AccountManagerService
        mAuthenticatorCache = new AccountAuthenticatorCache(mContext);
        mAuthenticatorCache.setListener(this, null /* Handler */);

        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);

        sThis.set(this);

        validateAccounts();
@@ -988,7 +998,7 @@ public class AccountManagerService
        final int index = titleAndSubtitle.indexOf('\n');
        final String title = titleAndSubtitle.substring(0, index);
        final String subtitle = titleAndSubtitle.substring(index + 1);
        n.setLatestEventInfo(mContext,
        n.setLatestEventInfo(getUiContext(),
                title, subtitle,
                PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
        ((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE))
@@ -1768,7 +1778,7 @@ public class AccountManagerService
                        0 /* when */);
                final String notificationTitleFormat =
                        mContext.getText(R.string.notification_title).toString();
                n.setLatestEventInfo(mContext,
                n.setLatestEventInfo(getUiContext(),
                        String.format(notificationTitleFormat, account.name),
                        message, PendingIntent.getActivity(
                        mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
@@ -1790,6 +1800,13 @@ public class AccountManagerService
        }
    }

    private Context getUiContext() {
        if (mUiContext == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
        }
        return mUiContext != null ? mUiContext : mContext;
    }

    /** Succeeds if any of the specified permissions are granted. */
    private void checkBinderPermission(String... permissions) {
        final int uid = Binder.getCallingUid();
+20 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.util.EventLog;
import android.util.Log;
import android.util.TimeUtils;

import com.android.internal.app.ThemeUtils;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DataConnectionTracker;
@@ -140,6 +141,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
     */
    private Notification mNotification;

    private Context mUiContext;

    /** Wake lock used while setting time of day. */
    private PowerManager.WakeLock mWakeLock;
    private static final String WAKELOCK_TAG = "ServiceStateTracker";
@@ -176,6 +179,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
        }
    };

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
        }
    };

    private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
        @Override
        public void onChange(boolean selfChange) {
@@ -226,6 +235,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_LOCALE_CHANGED);
        phone.getContext().registerReceiver(mIntentReceiver, filter);

        ThemeUtils.registerThemeChangeReceiver(phone.getContext(), mThemeChangeReceiver);
    }

    public void dispose() {
@@ -1361,6 +1372,14 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
        return a*10 + b;
    }

    private Context getUiContext() {
        Context mainContext = phone.getContext();
        if (mUiContext == null) {
            mUiContext = ThemeUtils.createUiContext(mainContext);
        }
        return mUiContext != null ? mUiContext : mainContext;
    }

    /**
     * @return The current GPRS state. IN_SERVICE is the same as "attached"
     * and OUT_OF_SERVICE is the same as detached.
@@ -1678,7 +1697,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {

        Log.d(LOG_TAG, "[DSAC DEB] " + "put notification " + title + " / " +details);
        mNotification.tickerText = title;
        mNotification.setLatestEventInfo(context, title, details,
        mNotification.setLatestEventInfo(getUiContext(), title, details,
                mNotification.contentIntent);

        NotificationManager notificationManager = (NotificationManager)