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

Commit 281cdca5 authored by Jared Duke's avatar Jared Duke
Browse files

Delete unused SystemUI tuner prefs code

The OtherPrefs fragment appears to be unused. Delete it and downstream
code/resource references.

Flag: NONE
Bug: 301283783
Test: m + presubmit
Change-Id: I715d3a405ef49dbce24a53f058df9bbe33f186e6
parent 3397af24
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include layout="@layout/switch_bar" />

    <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="16dp"
            android:text="@string/power_notification_controls_description"/>

</LinearLayout>
+0 −28
Original line number Diff line number Diff line
@@ -1569,37 +1569,9 @@
    <!-- Bluetooth enablement ok text [CHAR LIMIT=40] -->
    <string name="enable_bluetooth_confirmation_ok">Turn on</string>

    <!-- [CHAR LIMIT=NONE] Importance Tuner setting title -->
    <string name="tuner_full_importance_settings">Power notification controls</string>

    <!-- [CHAR LIMIT=NONE] Notification camera based rotation enabled description -->
    <string name="rotation_lock_camera_rotation_on">On - Face-based</string>

    <string name="power_notification_controls_description">With power notification controls, you can set an importance level from 0 to 5 for an app\'s notifications.
        \n\n<b>Level 5</b>
        \n- Show at the top of the notification list
        \n- Allow full screen interruption
        \n- Always peek
        \n\n<b>Level 4</b>
        \n- Prevent full screen interruption
        \n- Always peek
        \n\n<b>Level 3</b>
        \n- Prevent full screen interruption
        \n- Never peek
        \n\n<b>Level 2</b>
        \n- Prevent full screen interruption
        \n- Never peek
        \n- Never make sound and vibration
        \n\n<b>Level 1</b>
        \n- Prevent full screen interruption
        \n- Never peek
        \n- Never make sound or vibrate
        \n- Hide from lock screen and status bar
        \n- Show at the bottom of the notification list
        \n\n<b>Level 0</b>
        \n- Block all notifications from the app
    </string>

    <!-- Notification Inline controls: button to dismiss the blocking helper [CHAR_LIMIT=20] -->
    <string name="inline_done_button">Done</string>

+0 −27
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:sysui="http://schemas.android.com/apk/res-auto"
                  android:title="@string/other">

    <!-- importance -->
    <Preference
            android:key="power_notification_controls"
            android:title="@string/tuner_full_importance_settings"
            android:fragment="com.android.systemui.tuner.PowerNotificationControlsFragment"/>

</PreferenceScreen>
+0 −33
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.systemui.tuner;

import android.os.Bundle;

import androidx.preference.PreferenceFragment;

import com.android.systemui.res.R;
import com.android.tools.r8.keepanno.annotations.KeepTarget;
import com.android.tools.r8.keepanno.annotations.UsesReflection;

public class OtherPrefs extends PreferenceFragment {
    // aapt doesn't generate keep rules for android:fragment references in <Preference> tags, so
    // explicitly declare references per usage in `R.xml.other_settings`. See b/120445169.
    @UsesReflection(@KeepTarget(classConstant = PowerNotificationControlsFragment.class))
    @Override
    public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
        addPreferencesFromResource(R.xml.other_settings);
    }
}
+0 −93
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.systemui.tuner;

import android.annotation.Nullable;
import android.app.Fragment;
import android.os.Bundle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
import android.widget.TextView;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.res.R;

public class PowerNotificationControlsFragment extends Fragment {

    private static final String KEY_SHOW_PNC = "show_importance_slider";

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.power_notification_controls_settings, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        final View switchBar = view.findViewById(R.id.switch_bar);
        final Switch switchWidget = (Switch) switchBar.findViewById(android.R.id.switch_widget);
        final TextView switchText = (TextView) switchBar.findViewById(R.id.switch_text);
        switchWidget.setChecked(isEnabled());
        switchText.setText(isEnabled()
                ? getString(R.string.switch_bar_on)
                : getString(R.string.switch_bar_off));

        switchWidget.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean newState = !isEnabled();
                MetricsLogger.action(getContext(),
                        MetricsEvent.ACTION_TUNER_POWER_NOTIFICATION_CONTROLS, newState);
                Settings.Secure.putInt(getContext().getContentResolver(),
                        KEY_SHOW_PNC, newState ? 1 : 0);
                switchWidget.setChecked(newState);
                switchText.setText(newState
                        ? getString(R.string.switch_bar_on)
                        : getString(R.string.switch_bar_off));
            }
        });
    }

    @Override
    public void onResume() {
        super.onResume();
        MetricsLogger.visibility(
                getContext(), MetricsEvent.TUNER_POWER_NOTIFICATION_CONTROLS, true);
    }

    @Override
    public void onPause() {
        super.onPause();
        MetricsLogger.visibility(
                getContext(), MetricsEvent.TUNER_POWER_NOTIFICATION_CONTROLS, false);
    }

    private boolean isEnabled() {
        int setting = Settings.Secure.getInt(getContext().getContentResolver(), KEY_SHOW_PNC, 0);
        return setting == 1;
    }

}