Loading res/drawable/ic_volume_ringer_mute.xml 0 → 100644 +38 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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:height="24dp" android:viewportHeight="23.4" android:viewportWidth="23.3" android:width="24dp" android:tint="?android:attr/colorControlNormal"> <group android:translateX="-0.85" android:translateY="-0.5"> <path android:fillColor="#FFF" android:pathData="M20.73,19.46l-0.6,-0.6c0,0 0,0 0,0L5.54,4.26c-0.35,-0.35 -0.92,-0.35 -1.27,0c-0.35,0.35 -0.35,0.92 0,1.27l2.4,2.4C6.25,8.85 6,9.88 6,11v5l-2.15,2.15c-0.19,0.2 -0.19,0.51 0.01,0.71C3.95,18.95 4.07,19 4.2,19h13.53l1.73,1.73c0.35,0.35 0.92,0.35 1.27,0C21.09,20.38 21.09,19.81 20.73,19.46z" /> <path android:fillColor="#FFF" android:pathData="M18,11c0,-3.07 -1.64,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C9.87,4.83 9.31,5.08 8.8,5.4l9.2,9.2V11z" /> <path android:fillColor="#FFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z" /> </group> </vector> res/drawable/ic_volume_ringer_vibrate.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp" android:tint="?android:attr/colorControlNormal"> <path android:fillColor="#FFFFFF" android:pathData="M1,15c0.55,0 1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v4c0,0.55 0.45,1 1,1zM4,17c0.55,0 1,-0.45 1,-1L5,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM22,10v4c0,0.55 0.45,1 1,1s1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1zM20,17c0.55,0 1,-0.45 1,-1L21,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM16.5,3h-9C6.67,3 6,3.67 6,4.5v15c0,0.83 0.67,1.5 1.5,1.5h9c0.83,0 1.5,-0.67 1.5,-1.5v-15c0,-0.83 -0.67,-1.5 -1.5,-1.5zM16,19L8,19L8,5h8v14z" /> </vector> src/com/android/settings/dashboard/conditional/AbnormalRingerConditionBase.java 0 → 100644 +83 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.dashboard.conditional; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.provider.Settings; import com.android.settings.R; public abstract class AbnormalRingerConditionBase extends Condition { private final IntentFilter mFilter; protected final AudioManager mAudioManager; private final RingerModeChangeReceiver mReceiver; AbnormalRingerConditionBase(ConditionManager manager) { super(manager); mAudioManager = (AudioManager) mManager.getContext().getSystemService(Context.AUDIO_SERVICE); mReceiver = new RingerModeChangeReceiver(this); mFilter = new IntentFilter(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION); manager.getContext().registerReceiver(mReceiver, mFilter); } @Override public CharSequence[] getActions() { return new CharSequence[] { mManager.getContext().getText(R.string.condition_device_muted_action_turn_on_sound) }; } @Override public void onPrimaryClick() { mManager.getContext().startActivity( new Intent(Settings.ACTION_SOUND_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } @Override public void onActionClick(int index) { mAudioManager.setRingerModeInternal(AudioManager.RINGER_MODE_NORMAL); mAudioManager.setStreamVolume(AudioManager.STREAM_RING, 1, 0 /* flags */); refreshState(); } static class RingerModeChangeReceiver extends BroadcastReceiver { private final AbnormalRingerConditionBase mCondition; public RingerModeChangeReceiver(AbnormalRingerConditionBase condition) { mCondition = condition; } @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION.equals(action)) { mCondition.refreshState(); } } } } src/com/android/settings/dashboard/conditional/AirplaneModeCondition.java +0 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.net.ConnectivityManager; import android.provider.Settings; import android.util.Log; Loading src/com/android/settings/dashboard/conditional/ConditionManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.Xml; import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnPause; import com.android.settingslib.core.lifecycle.events.OnResume; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -153,6 +154,8 @@ public class ConditionManager implements LifecycleObserver, OnResume, OnPause { addIfMissing(BackgroundDataCondition.class, conditions); addIfMissing(WorkModeCondition.class, conditions); addIfMissing(NightDisplayCondition.class, conditions); addIfMissing(RingerMutedCondition.class, conditions); addIfMissing(RingerVibrateCondition.class, conditions); Collections.sort(conditions, CONDITION_COMPARATOR); } Loading Loading @@ -183,6 +186,10 @@ public class ConditionManager implements LifecycleObserver, OnResume, OnPause { return new WorkModeCondition(this); } else if (NightDisplayCondition.class == clz) { return new NightDisplayCondition(this); } else if (RingerMutedCondition.class == clz) { return new RingerMutedCondition(this); } else if (RingerVibrateCondition.class == clz) { return new RingerVibrateCondition(this); } Log.e(TAG, "unknown condition class: " + clz.getSimpleName()); return null; Loading Loading
res/drawable/ic_volume_ringer_mute.xml 0 → 100644 +38 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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:height="24dp" android:viewportHeight="23.4" android:viewportWidth="23.3" android:width="24dp" android:tint="?android:attr/colorControlNormal"> <group android:translateX="-0.85" android:translateY="-0.5"> <path android:fillColor="#FFF" android:pathData="M20.73,19.46l-0.6,-0.6c0,0 0,0 0,0L5.54,4.26c-0.35,-0.35 -0.92,-0.35 -1.27,0c-0.35,0.35 -0.35,0.92 0,1.27l2.4,2.4C6.25,8.85 6,9.88 6,11v5l-2.15,2.15c-0.19,0.2 -0.19,0.51 0.01,0.71C3.95,18.95 4.07,19 4.2,19h13.53l1.73,1.73c0.35,0.35 0.92,0.35 1.27,0C21.09,20.38 21.09,19.81 20.73,19.46z" /> <path android:fillColor="#FFF" android:pathData="M18,11c0,-3.07 -1.64,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C9.87,4.83 9.31,5.08 8.8,5.4l9.2,9.2V11z" /> <path android:fillColor="#FFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z" /> </group> </vector>
res/drawable/ic_volume_ringer_vibrate.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp" android:tint="?android:attr/colorControlNormal"> <path android:fillColor="#FFFFFF" android:pathData="M1,15c0.55,0 1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v4c0,0.55 0.45,1 1,1zM4,17c0.55,0 1,-0.45 1,-1L5,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM22,10v4c0,0.55 0.45,1 1,1s1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1zM20,17c0.55,0 1,-0.45 1,-1L21,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM16.5,3h-9C6.67,3 6,3.67 6,4.5v15c0,0.83 0.67,1.5 1.5,1.5h9c0.83,0 1.5,-0.67 1.5,-1.5v-15c0,-0.83 -0.67,-1.5 -1.5,-1.5zM16,19L8,19L8,5h8v14z" /> </vector>
src/com/android/settings/dashboard/conditional/AbnormalRingerConditionBase.java 0 → 100644 +83 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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.dashboard.conditional; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.provider.Settings; import com.android.settings.R; public abstract class AbnormalRingerConditionBase extends Condition { private final IntentFilter mFilter; protected final AudioManager mAudioManager; private final RingerModeChangeReceiver mReceiver; AbnormalRingerConditionBase(ConditionManager manager) { super(manager); mAudioManager = (AudioManager) mManager.getContext().getSystemService(Context.AUDIO_SERVICE); mReceiver = new RingerModeChangeReceiver(this); mFilter = new IntentFilter(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION); manager.getContext().registerReceiver(mReceiver, mFilter); } @Override public CharSequence[] getActions() { return new CharSequence[] { mManager.getContext().getText(R.string.condition_device_muted_action_turn_on_sound) }; } @Override public void onPrimaryClick() { mManager.getContext().startActivity( new Intent(Settings.ACTION_SOUND_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } @Override public void onActionClick(int index) { mAudioManager.setRingerModeInternal(AudioManager.RINGER_MODE_NORMAL); mAudioManager.setStreamVolume(AudioManager.STREAM_RING, 1, 0 /* flags */); refreshState(); } static class RingerModeChangeReceiver extends BroadcastReceiver { private final AbnormalRingerConditionBase mCondition; public RingerModeChangeReceiver(AbnormalRingerConditionBase condition) { mCondition = condition; } @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION.equals(action)) { mCondition.refreshState(); } } } }
src/com/android/settings/dashboard/conditional/AirplaneModeCondition.java +0 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.net.ConnectivityManager; import android.provider.Settings; import android.util.Log; Loading
src/com/android/settings/dashboard/conditional/ConditionManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.Xml; import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnPause; import com.android.settingslib.core.lifecycle.events.OnResume; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -153,6 +154,8 @@ public class ConditionManager implements LifecycleObserver, OnResume, OnPause { addIfMissing(BackgroundDataCondition.class, conditions); addIfMissing(WorkModeCondition.class, conditions); addIfMissing(NightDisplayCondition.class, conditions); addIfMissing(RingerMutedCondition.class, conditions); addIfMissing(RingerVibrateCondition.class, conditions); Collections.sort(conditions, CONDITION_COMPARATOR); } Loading Loading @@ -183,6 +186,10 @@ public class ConditionManager implements LifecycleObserver, OnResume, OnPause { return new WorkModeCondition(this); } else if (NightDisplayCondition.class == clz) { return new NightDisplayCondition(this); } else if (RingerMutedCondition.class == clz) { return new RingerMutedCondition(this); } else if (RingerVibrateCondition.class == clz) { return new RingerVibrateCondition(this); } Log.e(TAG, "unknown condition class: " + clz.getSimpleName()); return null; Loading