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

Commit d49ec62c authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am f3364080: Merge "New and improved silent mode on lockscreen." into ics-mr1

* commit 'f3364080':
  New and improved silent mode on lockscreen.
parents 6a828712 f3364080
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="false" android:drawable="@android:color/transparent" />
    <item android:state_selected="true"  android:drawable="@drawable/tab_selected_holo" />
</selector>
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:orientation="horizontal"

    android:paddingLeft="11dip"
    android:paddingLeft="16dip"
    android:paddingTop="6dip"
    android:paddingBottom="6dip"
    >
@@ -30,7 +30,7 @@
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_marginRight="9dip"
        android:layout_marginRight="16dip"
        />

    <LinearLayout
+97 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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="wrap_content"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:orientation="horizontal"
    >

    <LinearLayout
        android:id="@+id/option1"
        android:layout_width="64dp"
        android:layout_height="match_parent"
        android:background="?android:attr/actionBarItemBackground"
        >
        <ImageView
            android:layout_width="48dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginTop="6dp"
            android:layout_marginBottom="6dp"
            android:src="@drawable/ic_audio_vol_mute"
            android:scaleType="center"
            android:duplicateParentState="true"
            android:background="@drawable/silent_mode_indicator"
            />
    </LinearLayout>
    <!-- Spacer -->
    <View android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:visibility="invisible"/>

    <LinearLayout
        android:id="@+id/option2"
        android:layout_width="64dp"
        android:layout_height="match_parent"
        android:background="?android:attr/actionBarItemBackground"
        >
        <ImageView
            android:layout_width="48dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginTop="6dp"
            android:layout_marginBottom="6dp"
            android:src="@drawable/ic_audio_ring_notif_vibrate"
            android:scaleType="center"
            android:duplicateParentState="true"
            android:background="@drawable/silent_mode_indicator"
            />
    </LinearLayout>

    <!-- Spacer -->
    <View android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:visibility="invisible"/>

    <LinearLayout
        android:id="@+id/option3"
        android:layout_width="64dp"
        android:layout_height="match_parent"
        android:background="?android:attr/actionBarItemBackground"
        >
        <ImageView
            android:layout_width="48dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginTop="6dp"
            android:layout_marginBottom="6dp"
            android:src="@drawable/ic_audio_vol"
            android:scaleType="center"
            android:duplicateParentState="true"
            android:background="@drawable/silent_mode_indicator"
            />
    </LinearLayout>
</LinearLayout>
 No newline at end of file
+8 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.media.AudioManager.RINGER_MODE_SILENT;
import static android.media.AudioManager.RINGER_MODE_VIBRATE;

import android.app.ActivityManagerNative;
import android.app.KeyguardManager;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
import android.bluetooth.BluetoothA2dp;
@@ -319,6 +320,8 @@ public class AudioService extends IAudioService.Stub {
    private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000;
    // previous volume adjustment direction received by checkForRingerModeChange()
    private int mPrevVolDirection = AudioManager.ADJUST_SAME;
    // Keyguard manager proxy
    private KeyguardManager mKeyguardManager;

    ///////////////////////////////////////////////////////////////////////////
    // Construction
@@ -503,9 +506,10 @@ public class AudioService extends IAudioService.Stub {
            streamType = getActiveStreamType(suggestedStreamType);
        }

        // Play sounds on STREAM_RING only.
        // Play sounds on STREAM_RING only and if lock screen is not on.
        if ((flags & AudioManager.FLAG_PLAY_SOUND) != 0 &&
                ((STREAM_VOLUME_ALIAS[streamType] != AudioSystem.STREAM_RING))) {
                ((STREAM_VOLUME_ALIAS[streamType] != AudioSystem.STREAM_RING)
                 || (mKeyguardManager != null && mKeyguardManager.isKeyguardLocked()))) {
            flags &= ~AudioManager.FLAG_PLAY_SOUND;
        }

@@ -2665,6 +2669,8 @@ public class AudioService extends IAudioService.Stub {
                sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SHARED_MSG, SENDMSG_NOOP,
                        0, 0, null, 0);

                mKeyguardManager =
                        (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
                mScoConnectionState = AudioManager.SCO_AUDIO_STATE_ERROR;
                resetBluetoothSco();
                getBluetoothHeadset();
+19 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 72;
    private static final int DATABASE_VERSION = 73;

    private Context mContext;

@@ -961,6 +961,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
                        + " VALUES(?,?);");
                loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
                        R.bool.def_accessibility_speak_password);
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
                if (stmt != null) stmt.close();
@@ -968,6 +969,23 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 72;
        }

        if (upgradeVersion == 72) {
            // update vibration settings
            db.beginTransaction();
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)"
                        + " VALUES(?,?);");
                loadBooleanSetting(stmt, Settings.System.VIBRATE_IN_SILENT,
                        R.bool.def_vibrate_in_silent);
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
                if (stmt != null) stmt.close();
            }
            upgradeVersion = 73;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
Loading