Merge "Fix 5386408: Fix battery state information propagation in Lock Screen"
diff --git a/core/java/android/app/SharedPreferencesImpl.java b/core/java/android/app/SharedPreferencesImpl.java
index 8aee65c..615e8ce 100644
--- a/core/java/android/app/SharedPreferencesImpl.java
+++ b/core/java/android/app/SharedPreferencesImpl.java
@@ -29,6 +29,7 @@
import org.xmlpull.v1.XmlPullParserException;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -107,7 +108,8 @@
FileStatus stat = new FileStatus();
if (FileUtils.getFileStatus(mFile.getPath(), stat) && mFile.canRead()) {
try {
- FileInputStream str = new FileInputStream(mFile);
+ BufferedInputStream str = new BufferedInputStream(
+ new FileInputStream(mFile), 16*1024);
map = XmlUtils.readMapXml(str);
str.close();
} catch (XmlPullParserException e) {
diff --git a/core/java/com/android/internal/widget/TransportControlView.java b/core/java/com/android/internal/widget/TransportControlView.java
index 1042a59..73d9f10 100644
--- a/core/java/com/android/internal/widget/TransportControlView.java
+++ b/core/java/com/android/internal/widget/TransportControlView.java
@@ -336,20 +336,27 @@
if (state == mPlayState) {
return;
}
+ final int imageResId;
+ final int imageDescId;
switch (state) {
case RemoteControlClient.PLAYSTATE_PLAYING:
- mBtnPlay.setImageResource(com.android.internal.R.drawable.ic_media_pause);
+ imageResId = com.android.internal.R.drawable.ic_media_pause;
+ imageDescId = com.android.internal.R.string.lockscreen_transport_pause_description;
break;
case RemoteControlClient.PLAYSTATE_BUFFERING:
- mBtnPlay.setImageResource(com.android.internal.R.drawable.ic_media_stop);
+ imageResId = com.android.internal.R.drawable.ic_media_stop;
+ imageDescId = com.android.internal.R.string.lockscreen_transport_stop_description;
break;
case RemoteControlClient.PLAYSTATE_PAUSED:
default:
- mBtnPlay.setImageResource(com.android.internal.R.drawable.ic_media_play);
+ imageResId = com.android.internal.R.drawable.ic_media_play;
+ imageDescId = com.android.internal.R.string.lockscreen_transport_play_description;
break;
}
+ mBtnPlay.setImageResource(imageResId);
+ mBtnPlay.setContentDescription(getResources().getString(imageDescId));
mPlayState = state;
}
diff --git a/core/res/res/layout/keyguard_transport_control.xml b/core/res/res/layout/keyguard_transport_control.xml
index 2ebe5fc..6e24ce2 100644
--- a/core/res/res/layout/keyguard_transport_control.xml
+++ b/core/res/res/layout/keyguard_transport_control.xml
@@ -66,7 +66,8 @@
android:src="@drawable/ic_media_rew"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
- android:padding="10dip"/>
+ android:padding="10dip"
+ android:contentDescription="@string/lockscreen_transport_prev_description"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
@@ -80,7 +81,8 @@
android:clickable="true"
android:src="@drawable/ic_media_play"
android:background="?android:attr/selectableItemBackground"
- android:padding="10dip"/>
+ android:padding="10dip"
+ android:contentDescription="@string/lockscreen_transport_play_description"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
@@ -94,7 +96,8 @@
android:clickable="true"
android:src="@drawable/ic_media_ff"
android:background="?android:attr/selectableItemBackground"
- android:padding="10dip"/>
+ android:padding="10dip"
+ android:contentDescription="@string/lockscreen_transport_next_description"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3f0f2f34..fb4783b 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -953,7 +953,7 @@
social updates from your friends. Malicious apps can use this to pretend to be a friend
and trick you into revealing passwords or other confidential information.</string>
-
+
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_readCalendar">read calendar events plus confidential information</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1831,6 +1831,17 @@
<string name="lockscreen_permanent_disabled_sim_instructions">Your SIM card is permanently disabled.\n
Please contact your wireless service provider to obtain another SIM card.</string>
+ <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
+ <string name="lockscreen_transport_prev_description">Previous track button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button goes to next track. -->
+ <string name="lockscreen_transport_next_description">Next track button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
+ <string name="lockscreen_transport_pause_description">Pause button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
+ <string name="lockscreen_transport_play_description">Play button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
+ <string name="lockscreen_transport_stop_description">Stop button</string>
+
<!-- Shown in the lock screen when there is emergency calls only mode. -->
<string name="emergency_calls_only" msgid="2485604591272668370">Emergency calls only</string>
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 78dbbd6..1941c6a 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -1677,6 +1677,18 @@
e.fillInStackTrace();
Slog.i(TAG, "Set screen state: " + on, e);
}
+ if (on) {
+ if ((mPowerState & SCREEN_ON_BIT) == 0 || mSkippedScreenOn) {
+ // If we are turning the screen state on, but the screen
+ // light is currently off, then make sure that we set the
+ // light at this point to 0. This is the case where we are
+ // turning on the screen and waiting for the UI to be drawn
+ // before showing it to the user. We want the light off
+ // until it is ready to be shown to the user, not it using
+ // whatever the last value it had.
+ mScreenBrightness.forceValueLocked(Power.BRIGHTNESS_OFF);
+ }
+ }
int err = Power.setScreenState(on);
if (err == 0) {
mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0);
@@ -2029,8 +2041,6 @@
RuntimeException e = new RuntimeException("here");
e.fillInStackTrace();
Slog.i(TAG, "Setting screen brightness: " + brightness, e);
- mScreenBrightness.setTargetLocked(brightness, steps,
- INITIAL_SCREEN_BRIGHTNESS, nominalCurrentValue);
}
}
@@ -2103,6 +2113,15 @@
+ " delta=" + delta);
}
+ void forceValueLocked(int value) {
+ targetValue = -1;
+ curValue = value;
+ setLightBrightness(mask, value);
+ if (animating) {
+ finishAnimationLocked(false, value);
+ }
+ }
+
void setTargetLocked(int target, int stepsToTarget, int initialValue,
int nominalCurrentValue) {
if (!initialized) {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index b01a6a3..a778dcb 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1814,6 +1814,8 @@
// redraw the screen entirely...
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
const size_t count = layers.size();
for (size_t i=0 ; i<count ; ++i) {
@@ -1845,7 +1847,7 @@
const DisplayHardware& hw(graphicPlane(0).displayHardware());
const uint32_t hw_w = hw.getWidth();
const uint32_t hw_h = hw.getHeight();
- const Region screenBounds(hw.bounds());
+ const Region screenBounds(hw.getBounds());
GLfloat u, v;
GLuint tname;
@@ -1855,7 +1857,7 @@
}
GLfloat vtx[8];
- const GLfloat texCoords[4][2] = { {0,1}, {0,1-v}, {u,1-v}, {u,1} };
+ const GLfloat texCoords[4][2] = { {0,0}, {0,v}, {u,v}, {u,0} };
glBindTexture(GL_TEXTURE_2D, tname);
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -1941,6 +1943,12 @@
s_curve_interpolator itb(nbFrames, 8.5f);
v_stretch vverts(hw_w, hw_h);
+
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
for (int i=0 ; i<nbFrames ; i++) {