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

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

Merge "Applying theming to more framework items." into gingerbread

parents 264ebb11 0794fc40
Loading
Loading
Loading
Loading
+18 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.content;
package android.content;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.app.ThemeUtils;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ArrayUtils;


import android.accounts.Account;
import android.accounts.Account;
@@ -131,6 +132,7 @@ public class SyncManager implements OnAccountsUpdateListener {
    private static final String HANDLE_SYNC_ALARM_WAKE_LOCK = "SyncManagerHandleSyncAlarm";
    private static final String HANDLE_SYNC_ALARM_WAKE_LOCK = "SyncManagerHandleSyncAlarm";


    private Context mContext;
    private Context mContext;
    private Context mUiContext;


    private volatile Account[] mAccounts = INITIAL_ACCOUNTS_ARRAY;
    private volatile Account[] mAccounts = INITIAL_ACCOUNTS_ARRAY;


@@ -185,6 +187,12 @@ public class SyncManager implements OnAccountsUpdateListener {
        }
        }
    };
    };


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

    private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() {
    private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
        public void onReceive(Context context, Intent intent) {
            if (getConnectivityManager().getBackgroundDataSetting()) {
            if (getConnectivityManager().getBackgroundDataSetting()) {
@@ -356,6 +364,8 @@ public class SyncManager implements OnAccountsUpdateListener {
        intentFilter.setPriority(100);
        intentFilter.setPriority(100);
        context.registerReceiver(mShutdownIntentReceiver, intentFilter);
        context.registerReceiver(mShutdownIntentReceiver, intentFilter);


        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);

        if (!factoryTest) {
        if (!factoryTest) {
            mNotificationMgr = (NotificationManager)
            mNotificationMgr = (NotificationManager)
                context.getSystemService(Context.NOTIFICATION_SERVICE);
                context.getSystemService(Context.NOTIFICATION_SERVICE);
@@ -868,6 +878,13 @@ public class SyncManager implements OnAccountsUpdateListener {
        }
        }
    }
    }


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

    /**
    /**
     * @hide
     * @hide
     */
     */
@@ -2057,7 +2074,7 @@ public class SyncManager implements OnAccountsUpdateListener {
                new Notification(R.drawable.stat_notify_sync_error,
                new Notification(R.drawable.stat_notify_sync_error,
                        mContext.getString(R.string.contentServiceSync),
                        mContext.getString(R.string.contentServiceSync),
                        System.currentTimeMillis());
                        System.currentTimeMillis());
            notification.setLatestEventInfo(mContext,
            notification.setLatestEventInfo(getUiContext(),
                    mContext.getString(R.string.contentServiceSyncNotificationTitle),
                    mContext.getString(R.string.contentServiceSyncNotificationTitle),
                    String.format(tooManyDeletesDescFormat.toString(), authorityName),
                    String.format(tooManyDeletesDescFormat.toString(), authorityName),
                    pendingIntent);
                    pendingIntent);
+10 −9
Original line number Original line Diff line number Diff line
@@ -81,6 +81,14 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
    private Context mUiContext;
    private Context mUiContext;
    private ProgressDialog mCheckingDialog;
    private ProgressDialog mCheckingDialog;


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

    /**
    /**
     * AccountUnlockScreen constructor.
     * AccountUnlockScreen constructor.
     * @param configuration
     * @param configuration
@@ -93,14 +101,6 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        mCallback = callback;
        mCallback = callback;
        mLockPatternUtils = lockPatternUtils;
        mLockPatternUtils = lockPatternUtils;


        ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                mUiContext = null;
                mCheckingDialog = null;
            }
        });

        LayoutInflater.from(context).inflate(
        LayoutInflater.from(context).inflate(
                R.layout.keyguard_screen_glogin_unlock, this, true);
                R.layout.keyguard_screen_glogin_unlock, this, true);


@@ -153,7 +153,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree


    /** {@inheritDoc} */
    /** {@inheritDoc} */
    public void onPause() {
    public void onPause() {

        mContext.unregisterReceiver(mThemeChangeReceiver);
    }
    }


    /** {@inheritDoc} */
    /** {@inheritDoc} */
@@ -163,6 +163,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        mPassword.setText("");
        mPassword.setText("");
        mLogin.requestFocus();
        mLogin.requestFocus();
        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }
    }


    /** {@inheritDoc} */
    /** {@inheritDoc} */
+27 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.policy.impl;
package com.android.internal.policy.impl;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.app.ThemeUtils;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils;


@@ -28,6 +29,7 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.accounts.OperationCanceledException;
import android.app.AlertDialog;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Configuration;
@@ -79,6 +81,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
    private View mLockScreen;
    private View mLockScreen;
    private View mUnlockScreen;
    private View mUnlockScreen;


    private Context mUiContext;

    private boolean mScreenOn = false;
    private boolean mScreenOn = false;
    private boolean mEnableFallback = false; // assume no fallback UI until we know better
    private boolean mEnableFallback = false; // assume no fallback UI until we know better


@@ -187,6 +191,12 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
        }
        }
    };
    };


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

    /**
    /**
     * @return Whether we are stuck on the lock screen because the sim is
     * @return Whether we are stuck on the lock screen because the sim is
     *   missing.
     *   missing.
@@ -541,9 +551,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
        updateScreen(mMode);
        updateScreen(mMode);
    }
    }


    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    @Override
    @Override
    protected void onDetachedFromWindow() {
    protected void onDetachedFromWindow() {
        removeCallbacks(mRecreateRunnable);
        removeCallbacks(mRecreateRunnable);
        mContext.unregisterReceiver(mThemeChangeReceiver);
        mUiContext = null;
        super.onDetachedFromWindow();
        super.onDetachedFromWindow();
    }
    }


@@ -836,7 +854,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
                timeoutInSeconds);
                timeoutInSeconds);
        }
        }


        final AlertDialog dialog = new AlertDialog.Builder(mContext)
        final AlertDialog dialog = new AlertDialog.Builder(getUiContext())
                .setTitle(null)
                .setTitle(null)
                .setMessage(message)
                .setMessage(message)
                .setNeutralButton(R.string.ok, null)
                .setNeutralButton(R.string.ok, null)
@@ -852,6 +870,13 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
        dialog.show();
        dialog.show();
    }
    }


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

    private void showAlmostAtAccountLoginDialog() {
    private void showAlmostAtAccountLoginDialog() {
        int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
        int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
        String message;
        String message;
@@ -872,7 +897,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
                timeoutInSeconds);
                timeoutInSeconds);
        }
        }


        final AlertDialog dialog = new AlertDialog.Builder(mContext)
        final AlertDialog dialog = new AlertDialog.Builder(getUiContext())
                .setTitle(null)
                .setTitle(null)
                .setMessage(message)
                .setMessage(message)
                .setNeutralButton(R.string.ok, null)
                .setNeutralButton(R.string.ok, null)
+11 −9
Original line number Original line Diff line number Diff line
@@ -72,6 +72,14 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie


    private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
    private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};


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

    public SimUnlockScreen(Context context, Configuration configuration,
    public SimUnlockScreen(Context context, Configuration configuration,
            KeyguardUpdateMonitor updateMonitor, KeyguardScreenCallback callback,
            KeyguardUpdateMonitor updateMonitor, KeyguardScreenCallback callback,
            LockPatternUtils lockpatternutils) {
            LockPatternUtils lockpatternutils) {
@@ -79,14 +87,6 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        mUpdateMonitor = updateMonitor;
        mUpdateMonitor = updateMonitor;
        mCallback = callback;
        mCallback = callback;


        ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                mUiContext = null;
                mSimUnlockProgressDialog = null;
            }
        });

        mCreationOrientation = configuration.orientation;
        mCreationOrientation = configuration.orientation;
        mKeyboardHidden = configuration.hardKeyboardHidden;
        mKeyboardHidden = configuration.hardKeyboardHidden;
        mLockPatternUtils = lockpatternutils;
        mLockPatternUtils = lockpatternutils;
@@ -127,7 +127,8 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie


    /** {@inheritDoc} */
    /** {@inheritDoc} */
    public void onPause() {
    public void onPause() {

        mContext.unregisterReceiver(mThemeChangeReceiver);
        mUiContext = null;
    }
    }


    /** {@inheritDoc} */
    /** {@inheritDoc} */
@@ -141,6 +142,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        mEnteredDigits = 0;
        mEnteredDigits = 0;


        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }
    }


    /** {@inheritDoc} */
    /** {@inheritDoc} */
+20 −1
Original line number Original line Diff line number Diff line
@@ -16,10 +16,13 @@


package com.android.server;
package com.android.server;


import com.android.internal.app.ThemeUtils;
import com.android.server.am.ActivityManagerService;
import com.android.server.am.ActivityManagerService;

import android.app.Notification;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
@@ -76,6 +79,7 @@ class DeviceStorageMonitorService extends Binder {
    private boolean mLowMemFlag=false;
    private boolean mLowMemFlag=false;
    private boolean mMemFullFlag=false;
    private boolean mMemFullFlag=false;
    private Context mContext;
    private Context mContext;
    private Context mUiContext;
    private ContentResolver mContentResolver;
    private ContentResolver mContentResolver;
    private long mTotalMemory;  // on /data/data
    private long mTotalMemory;  // on /data/data
    private StatFs mDataFileStats;
    private StatFs mDataFileStats;
@@ -302,6 +306,14 @@ class DeviceStorageMonitorService extends Binder {
        mLastReportedFreeMemTime = 0;
        mLastReportedFreeMemTime = 0;
        mContext = context;
        mContext = context;
        mContentResolver = mContext.getContentResolver();
        mContentResolver = mContext.getContentResolver();

        ThemeUtils.registerThemeChangeReceiver(mContext, new BroadcastReceiver() {
            @Override
            public void onReceive(Context content, Intent intent) {
                mUiContext = null;
            }
        });

        //create StatFs object
        //create StatFs object
        mDataFileStats = new StatFs(DATA_PATH);
        mDataFileStats = new StatFs(DATA_PATH);
        mSystemFileStats = new StatFs(SYSTEM_PATH);
        mSystemFileStats = new StatFs(SYSTEM_PATH);
@@ -349,7 +361,7 @@ class DeviceStorageMonitorService extends Binder {
        notification.icon = com.android.internal.R.drawable.stat_notify_disk_full;
        notification.icon = com.android.internal.R.drawable.stat_notify_disk_full;
        notification.tickerText = title;
        notification.tickerText = title;
        notification.flags |= Notification.FLAG_NO_CLEAR;
        notification.flags |= Notification.FLAG_NO_CLEAR;
        notification.setLatestEventInfo(mContext, title, details, intent);
        notification.setLatestEventInfo(getUiContext(), title, details, intent);
        mNotificationMgr.notify(LOW_MEMORY_NOTIFICATION_ID, notification);
        mNotificationMgr.notify(LOW_MEMORY_NOTIFICATION_ID, notification);
        mContext.sendStickyBroadcast(mStorageLowIntent);
        mContext.sendStickyBroadcast(mStorageLowIntent);
    }
    }
@@ -394,4 +406,11 @@ class DeviceStorageMonitorService extends Binder {
        // force an early check
        // force an early check
        postCheckMemoryMsg(true, 0);
        postCheckMemoryMsg(true, 0);
    }
    }

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