FileDocCategorySizeDatePackage
CompatModeDialog.javaAPI DocAndroid 5.1 API3724Thu Mar 12 22:22:42 GMT 2015com.android.server.am

CompatModeDialog

public final class CompatModeDialog extends android.app.Dialog

Fields Summary
final ActivityManagerService
mService
final android.content.pm.ApplicationInfo
mAppInfo
final android.widget.Switch
mCompatEnabled
final android.widget.CheckBox
mAlwaysShow
final android.view.View
mHint
Constructors Summary
public CompatModeDialog(ActivityManagerService service, android.content.Context context, android.content.pm.ApplicationInfo appInfo)

        super(context, com.android.internal.R.style.Theme_Holo_Dialog_MinWidth);
        setCancelable(true);
        setCanceledOnTouchOutside(true);
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        getWindow().setType(WindowManager.LayoutParams.TYPE_PHONE);
        getWindow().setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL);
        mService = service;
        mAppInfo = appInfo;

        setContentView(com.android.internal.R.layout.am_compat_mode_dialog);
        mCompatEnabled = (Switch)findViewById(com.android.internal.R.id.compat_checkbox);
        mCompatEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                synchronized (mService) {
                    mService.mCompatModePackages.setPackageScreenCompatModeLocked(
                            mAppInfo.packageName,
                            mCompatEnabled.isChecked() ? ActivityManager.COMPAT_MODE_ENABLED
                                    : ActivityManager.COMPAT_MODE_DISABLED);
                    updateControls();
                }
            }
        });
        mAlwaysShow = (CheckBox)findViewById(com.android.internal.R.id.ask_checkbox);
        mAlwaysShow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                synchronized (mService) {
                    mService.mCompatModePackages.setPackageAskCompatModeLocked(
                            mAppInfo.packageName, mAlwaysShow.isChecked());
                    updateControls();
                }
            }
        });
        mHint = findViewById(com.android.internal.R.id.reask_hint);

        updateControls();
    
Methods Summary
voidupdateControls()

        synchronized (mService) {
            int mode = mService.mCompatModePackages.computeCompatModeLocked(mAppInfo);
            mCompatEnabled.setChecked(mode == ActivityManager.COMPAT_MODE_ENABLED);
            boolean ask = mService.mCompatModePackages.getPackageAskCompatModeLocked(
                    mAppInfo.packageName);
            mAlwaysShow.setChecked(ask);
            mHint.setVisibility(ask ? View.INVISIBLE : View.VISIBLE);
        }