am 89e6b425: Merge branch \'eclair-plus-aosp\' of ssh://android-git.corp.google.com:29418/platform/frameworks/policies/base into eclair-mr2-plus-aosp

Merge commit '89e6b425bcbecd8cb78b95c0c9a6bd4f34d25590'

* commit '89e6b425bcbecd8cb78b95c0c9a6bd4f34d25590':
  Fix issue #2171460: Turn off background blurring of power dialog
  Fix issue #2171766: Device can go to sleep while in dock
This commit is contained in:
Neel Parekh
2009-10-12 12:41:27 -07:00
committed by Android Git Automerger
6 changed files with 52 additions and 32 deletions

View File

@@ -303,9 +303,12 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
mCheckingDialog.setCancelable(false);
mCheckingDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
mCheckingDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
if (!mContext.getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
mCheckingDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
}
return mCheckingDialog;
}

View File

@@ -213,8 +213,11 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
final AlertDialog dialog = ab.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
if (!mContext.getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
dialog.setOnDismissListener(this);

View File

@@ -575,9 +575,12 @@ public class LockPatternKeyguardView extends KeyguardViewBase
.setNeutralButton(R.string.ok, null)
.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
dialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
if (!mContext.getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
dialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
dialog.show();
}
@@ -595,9 +598,12 @@ public class LockPatternKeyguardView extends KeyguardViewBase
.setNeutralButton(R.string.ok, null)
.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
dialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
if (!mContext.getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
dialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
dialog.show();
}

View File

@@ -190,6 +190,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean mLidOpen;
int mPlugged;
boolean mRegisteredBatteryReceiver;
int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
int mLidOpenRotation;
int mCarDockRotation;
@@ -531,13 +532,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mLidNavigationAccessibility = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lidNavigationAccessibility);
// register for battery events
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_POWER_CONNECTED);
intentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED);
context.registerReceiver(mPowerReceiver, intentFilter);
mBatteryStatusFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
mPlugged = 0;
updatePlugged();
updatePlugged(context.registerReceiver(null, mBatteryStatusFilter));
// register for dock events
context.registerReceiver(mDockReceiver, new IntentFilter(Intent.ACTION_DOCK_EVENT));
mVibrator = new Vibrator();
@@ -551,8 +548,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
com.android.internal.R.array.config_safeModeEnabledVibePattern);
}
void updatePlugged() {
Intent powerIntent = mContext.registerReceiver(null, mBatteryStatusFilter);
void updatePlugged(Intent powerIntent) {
if (localLOGV) Log.v(TAG, "New battery status: " + powerIntent.getExtras());
if (powerIntent != null) {
mPlugged = powerIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
@@ -1832,14 +1828,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
};
BroadcastReceiver mPowerReceiver = new BroadcastReceiver() {
BroadcastReceiver mBatteryReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_POWER_CONNECTED.equals(intent.getAction())) {
updatePlugged();
} else if (Intent.ACTION_POWER_DISCONNECTED.equals(intent.getAction())) {
updatePlugged();
}
updateKeepScreenOn();
updatePlugged(intent);
updateDockKeepingScreenOn();
}
};
@@ -1847,8 +1839,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public void onReceive(Context context, Intent intent) {
mDockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE,
Intent.EXTRA_DOCK_STATE_UNDOCKED);
boolean watchBattery = mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED;
if (watchBattery != mRegisteredBatteryReceiver) {
mRegisteredBatteryReceiver = watchBattery;
if (watchBattery) {
updatePlugged(mContext.registerReceiver(mBatteryReceiver,
mBatteryStatusFilter));
} else {
mContext.unregisterReceiver(mBatteryReceiver);
}
}
updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
updateKeepScreenOn();
updateDockKeepingScreenOn();
updateOrientationListenerLp();
}
};
@@ -2036,7 +2038,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
}
void updateKeepScreenOn() {
void updateDockKeepingScreenOn() {
if (mPlugged != 0) {
if (localLOGV) Log.v(TAG, "Update: mDockState=" + mDockState
+ " mPlugged=" + mPlugged

View File

@@ -70,8 +70,11 @@ public class PowerDialog extends Dialog implements OnClickListener,
setContentView(com.android.internal.R.layout.power_dialog);
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
if (!getContext().getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

View File

@@ -182,9 +182,12 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
mSimUnlockProgressDialog.setCancelable(false);
mSimUnlockProgressDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
mSimUnlockProgressDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
if (!mContext.getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
mSimUnlockProgressDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
}
return mSimUnlockProgressDialog;
}