X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcom%2Fandroid%2Fsettings%2FSmsDefaultDialog.java;h=e8efa98adf8368269d9e2bfdccbc81fa22bec1c5;hb=8919b6a1ed187bc2100b85481caa4f20b1b2154b;hp=830187ccab5f53f0856dd3f5d8160571b465d9f0;hpb=9b8abd652a7688cfb3af67344baa25c9b2c70062;p=android-x86%2Fpackages-apps-Settings.git diff --git a/src/com/android/settings/SmsDefaultDialog.java b/src/com/android/settings/SmsDefaultDialog.java index 830187ccab..e8efa98adf 100644 --- a/src/com/android/settings/SmsDefaultDialog.java +++ b/src/com/android/settings/SmsDefaultDialog.java @@ -16,6 +16,8 @@ package com.android.settings; +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; + import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; @@ -30,6 +32,8 @@ import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; @@ -60,6 +64,22 @@ public final class SmsDefaultDialog extends AlertActivity implements } @Override + protected void onStart() { + super.onStart(); + getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); + android.util.EventLog.writeEvent(0x534e4554, "120484087", -1, ""); + } + + @Override + protected void onStop() { + super.onStop(); + final Window window = getWindow(); + final WindowManager.LayoutParams attrs = window.getAttributes(); + attrs.privateFlags &= ~PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; + window.setAttributes(attrs); + } + + @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case BUTTON_POSITIVE: @@ -84,7 +104,7 @@ public final class SmsDefaultDialog extends AlertActivity implements } private boolean buildDialog(String packageName) { - TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); + TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (!tm.isSmsCapable()) { // No phone, no SMS return false; @@ -125,6 +145,10 @@ public final class SmsDefaultDialog extends AlertActivity implements p.mOnClickListener = this; p.mNegativeButtonText = getString(R.string.cancel); p.mNegativeButtonListener = this; + if (p.mAdapter.isEmpty()) { + // If there is nothing to choose from, don't build the dialog. + return false; + } } setupAlert(); @@ -194,7 +218,7 @@ public final class SmsDefaultDialog extends AlertActivity implements } else { view.findViewById(R.id.default_label).setVisibility(View.GONE); } - ImageView imageView = (ImageView)view.findViewById(android.R.id.icon); + ImageView imageView = (ImageView) view.findViewById(android.R.id.icon); imageView.setImageDrawable(item.icon); return view; }