Skip to content

Commit

Permalink
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sbradymobile committed Nov 11, 2013
2 parents 356e10b + 9231058 commit c4a37bb
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/jni/android/graphics/BitmapRegionDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ static jobject nativeNewInstanceFromStream(JNIEnv* env, jobject clazz,
// for now we don't allow shareable with java inputstreams
SkMemoryStream *mStream = buildSkMemoryStream(stream);
largeBitmap = doBuildTileIndex(env, mStream);
// release the resources when decoding fails
if (largeBitmap == NULL) {
delete(mStream);
mStream = NULL;
}
stream->unref();
}
return largeBitmap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public void onPause() {
// R.anim.recents_return_to_launcher_enter,
// R.anim.recents_return_to_launcher_exit);
mForeground = false;
if (mRecentsPanel != null) {
mRecentsPanel.dismissContextMenuIfAny();
}
super.onPause();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ public boolean isInContentArea(int x, int y) {
}
}

public void dismissContextMenuIfAny() {
if(mPopup != null) {
mPopup.dismiss();
}
}
public void show(boolean show) {
show(show, null, false, false);
}
Expand Down Expand Up @@ -834,6 +839,9 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {

public void handleLongPress(
final View selectedView, final View anchorView, final View thumbnailView) {
if(mPopup != null) {
mPopup.dismiss();
}
thumbnailView.setSelected(true);
final PopupMenu popup =
new PopupMenu(mContext, anchorView == null ? selectedView : anchorView);
Expand Down
8 changes: 8 additions & 0 deletions services/java/com/android/server/am/NativeCrashListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ public void run() {
Slog.d(TAG, "Exception writing ack: " + e.getMessage());
}
}
finally {
try {
Slog.d(TAG, "Closing socket connection: " + peerFd);
Libcore.os.close(peerFd);
} catch (ErrnoException e) {
Slog.w(TAG, "Error closing socket connection", e);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ private void updatePowerState() {
if (!mElectronBeamOffAnimator.isStarted()) {
if (mPowerState.getElectronBeamLevel() == 0.0f) {
setScreenOn(false);
unblockScreenOn();
} else if (mPowerState.prepareElectronBeam(
mElectronBeamFadesConfig ?
ElectronBeam.MODE_FADE :
Expand Down
28 changes: 28 additions & 0 deletions services/java/com/android/server/power/ShutdownThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import android.util.Log;
import android.view.WindowManager;
import android.view.KeyEvent;
import java.lang.reflect.Method;

public final class ShutdownThread extends Thread {
// constants
Expand Down Expand Up @@ -602,6 +603,9 @@ public void run() {
* @param reason reason for reboot
*/
public static void rebootOrShutdown(boolean reboot, String reason) {
// Oem specific shutdown
deviceRebootOrShutdown(reboot, reason);

if (reboot) {
Log.i(TAG, "Rebooting, reason: " + reason);
try {
Expand Down Expand Up @@ -630,4 +634,28 @@ public static void rebootOrShutdown(boolean reboot, String reason) {
Log.i(TAG, "Performing low-level shutdown...");
PowerManagerService.lowLevelShutdown();
}

private static void deviceRebootOrShutdown(boolean reboot, String reason) {

Class<?> cl;
String deviceShutdownClassName = "com.android.server.power.ShutdownOem";

try{
cl = Class.forName(deviceShutdownClassName);
Method m;
try {
m = cl.getMethod("rebootOrShutdown", new Class[]{boolean.class, String.class});
m.invoke(cl.newInstance(), reboot, reason);

} catch (NoSuchMethodException ex) {
//Method not found.
} catch (Exception ex) {
//Unknown exception
}
}catch(ClassNotFoundException e){
//Classnotfound!
}catch(Exception e){
//Unknown exception
}
}
}

0 comments on commit c4a37bb

Please sign in to comment.