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

Commit a4e229c7 authored by d34d's avatar d34d
Browse files

Remove policy/ and merge GlobalActions changes into services

Change-Id: I17117c0a64f5792913cf8a5d74914be97ab87210
parent b4761c4d
Loading
Loading
Loading
Loading
+0 −1604

File deleted.

Preview size limit exceeded, changes collapsed.

+21 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ThemeUtils;
import android.content.pm.UserInfo;
import android.content.ServiceConnection;
import android.database.ContentObserver;
@@ -103,6 +104,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac

    private final Context mContext;
    private final WindowManagerFuncs mWindowManagerFuncs;
    private Context mUiContext;
    private final AudioManager mAudioManager;
    private final IDreamManager mDreamManager;

@@ -170,7 +172,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
    public void showDialog(boolean keyguardShowing, boolean isDeviceProvisioned) {
        mKeyguardShowing = keyguardShowing;
        mDeviceProvisioned = isDeviceProvisioned;
        if (mDialog != null) {
        if (mDialog != null && mUiContext == null) {
            mDialog.dismiss();
            mDialog = null;
            mDialog = createDialog();
@@ -212,6 +214,14 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
        }
    }

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

    /**
     * Create the global actions dialog.
     * @return A new dialog.
@@ -326,12 +336,12 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac

        mAdapter = new MyAdapter();

        AlertParams params = new AlertParams(mContext);
        AlertParams params = new AlertParams(getUiContext());
        params.mAdapter = mAdapter;
        params.mOnClickListener = this;
        params.mForceInverseBackground = true;

        GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params);
        GlobalActionsDialog dialog = new GlobalActionsDialog(getUiContext(), params);
        dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.

        dialog.getListView().setItemsCanFocus(true);
@@ -823,7 +833,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac

        public View getView(int position, View convertView, ViewGroup parent) {
            Action action = getItem(position);
            return action.create(mContext, convertView, parent, LayoutInflater.from(mContext));
            final Context context = getUiContext();
            return action.create(context, convertView, parent, LayoutInflater.from(context));
        }
    }

@@ -1204,6 +1215,12 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                Settings.Secure.POWER_MENU_ACTIONS, UserHandle.USER_CURRENT);
    }

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

    PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
        @Override
        public void onServiceStateChanged(ServiceState serviceState) {