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

Commit 3bd52ddf authored by Dan Sandler's avatar Dan Sandler
Browse files

Developer QS tile: Show Layout.

Bug: 27872042
Change-Id: I0df2ffecbf7d2682d89c9b8343590bb04bcc305c
parent c8d363e2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2914,5 +2914,17 @@
            </intent-filter>
       </receiver>

        <!-- Quick Settings tiles for Developer Options -->
        <service
                android:name=".qstile.ShowLayout"
                android:label="@string/debug_layout"
                android:icon="@drawable/tile_icon_show_layout"
                android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
                android:enabled="true">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>
        <!-- This is the longest AndroidManifest.xml ever. -->
    </application>
</manifest>
+60 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2015 The Android Open Source Project

   Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M12,7.2c-3.2,0 -5.9,2 -7,4.8c1.1,2.8 3.8,4.8 7,4.8s5.9,-2 7,-4.8C17.9,9.2 15.2,7.2 12,7.2zM12,15.2c-1.8,0 -3.2,-1.4 -3.2,-3.2s1.4,-3.2 3.2,-3.2s3.2,1.4 3.2,3.2S13.8,15.2 12,15.2zM12,10.1c-1.1,0 -1.9,0.9 -1.9,1.9s0.9,1.9 1.9,1.9s1.9,-0.9 1.9,-1.9S13.1,10.1 12,10.1z"/>
    <path
        android:fillColor="#80FFFFFF"
        android:pathData="M0.0,6.0h1.0v12.0h-1.0z"/>
    <path
        android:fillColor="#80FFFFFF"
        android:pathData="M6.0,0.0h12.0v1.0h-12.0z"/>
    <path
        android:fillColor="#80FFFFFF"
        android:pathData="M23.0,6.0h1.0v12.0h-1.0z"/>
    <path
        android:fillColor="#80FFFFFF"
        android:pathData="M6.0,23.0h12.0v1.0h-12.0z"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M1.0,23.0l0.0,-5.0l-1.0,0.0l0.0,6.0l6.0,0.0l0.0,-1.0z"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M1.0,1.0l5.0,0.0l0.0,-1.0l-6.0,0.0l0.0,6.0l1.0,0.0z"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M18.0,0.0l0.0,1.0l5.0,0.0l0.0,5.0l1.0,0.0l0.0,-6.0z"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M23.0,23.0l-5.0,0.0l0.0,1.0l6.0,0.0l0.0,-6.0l-1.0,0.0z"/>
    <path
        android:fillColor="#80FFFFFF"
        android:pathData="M9.5,6.0h5.0v1.0h-5.0z"/>
    <path
        android:fillColor="#80FFFFFF"
        android:pathData="M9.5,17.0h5.0v1.0h-5.0z"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M4.5,7.0l5.0,0.0l0.0,-1.0l-6.0,0.0l0.0,6.0l0.0,6.0l6.0,0.0l0.0,-1.0l-5.0,0.0l0.0,-5.0z"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M14.5,6.0l0.0,1.0l5.0,0.0l0.0,5.0l0.0,5.0l-5.0,0.0l0.0,1.0l6.0,0.0l0.0,-6.0l0.0,-6.0z"/>
</vector>
+1 −1
Original line number Diff line number Diff line
@@ -2078,7 +2078,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
        }
    };

    static class SystemPropPoker extends AsyncTask<Void, Void, Void> {
    public static class SystemPropPoker extends AsyncTask<Void, Void, Void> {
        @Override
        protected Void doInBackground(Void... params) {
            String[] services = ServiceManager.listServices();
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.android.settings.qstile;

import android.os.SystemProperties;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import android.view.View;
import com.android.settings.DevelopmentSettings;

public class ShowLayout extends TileService {
    @Override
    public void onStartListening() {
        super.onStartListening();
        refresh();
    }

    public void refresh() {
        getQsTile().setState(
            SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false)
                ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
        getQsTile().updateTile();
    }

    @Override
    public void onClick() {
        SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY,
                getQsTile().getState() == Tile.STATE_INACTIVE ? "true" : "false");
        new DevelopmentSettings.SystemPropPoker().execute(); // Settings app magic
        refresh();
    }
}