...for Market App iRunner There were a lot of serious issues with how we updated (or often didn't update) the display and resource state when switching compatibility mode in conjunction with restarting and updating application components. This addresses everything I could find. Unfortunately it does *not* fix this particular app. I am starting to think this is just an issue in the app. This change does fix a number of other problems I could repro, such as switching the compatibility mode of an IME. Also a few changes here and there to get rid of $#*&^!! debug logs. Change-Id: Ib15572eac9ec93b4b9966ddcbbc830ce9dec1317
99 lines
3.5 KiB
Java
99 lines
3.5 KiB
Java
/*
|
|
* 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.
|
|
*/
|
|
|
|
package com.android.server.wm;
|
|
|
|
import android.graphics.PixelFormat;
|
|
import android.util.Slog;
|
|
import android.view.Surface;
|
|
import android.view.SurfaceSession;
|
|
|
|
import java.io.PrintWriter;
|
|
|
|
class DimSurface {
|
|
Surface mDimSurface;
|
|
boolean mDimShown = false;
|
|
int mDimColor = 0;
|
|
int mLayer = -1;
|
|
int mLastDimWidth, mLastDimHeight;
|
|
|
|
DimSurface(SurfaceSession session) {
|
|
if (mDimSurface == null) {
|
|
if (WindowManagerService.SHOW_TRANSACTIONS ||
|
|
WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG,
|
|
" DIM " + mDimSurface + ": CREATE");
|
|
try {
|
|
mDimSurface = new Surface(session, 0,
|
|
"DimSurface",
|
|
-1, 16, 16, PixelFormat.OPAQUE,
|
|
Surface.FX_SURFACE_DIM);
|
|
mDimSurface.setAlpha(0.0f);
|
|
} catch (Exception e) {
|
|
Slog.e(WindowManagerService.TAG, "Exception creating Dim surface", e);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Show the dim surface.
|
|
*/
|
|
void show(int dw, int dh, int layer, int color) {
|
|
if (!mDimShown) {
|
|
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" +
|
|
dw + "x" + dh + ")");
|
|
mDimShown = true;
|
|
try {
|
|
mLastDimWidth = dw;
|
|
mLastDimHeight = dh;
|
|
mDimSurface.setPosition(0, 0);
|
|
mDimSurface.setSize(dw, dh);
|
|
mDimSurface.show();
|
|
} catch (RuntimeException e) {
|
|
Slog.w(WindowManagerService.TAG, "Failure showing dim surface", e);
|
|
}
|
|
} else if (mLastDimWidth != dw || mLastDimHeight != dh || mDimColor != color
|
|
|| mLayer != layer) {
|
|
mLastDimWidth = dw;
|
|
mLastDimHeight = dh;
|
|
mLayer = layer;
|
|
mDimColor = color;
|
|
mDimSurface.setSize(dw, dh);
|
|
mDimSurface.setLayer(layer);
|
|
mDimSurface.setAlpha(((color>>24)&0xff)/255.0f);
|
|
}
|
|
}
|
|
|
|
void hide() {
|
|
if (mDimShown) {
|
|
mDimShown = false;
|
|
try {
|
|
mDimSurface.hide();
|
|
} catch (RuntimeException e) {
|
|
Slog.w(WindowManagerService.TAG, "Illegal argument exception hiding dim surface");
|
|
}
|
|
}
|
|
}
|
|
|
|
public void printTo(String prefix, PrintWriter pw) {
|
|
pw.print(prefix); pw.print("mDimSurface="); pw.println(mDimSurface);
|
|
pw.print(prefix); pw.print("mDimShown="); pw.print(mDimShown);
|
|
pw.print(" mLayer="); pw.print(mLayer);
|
|
pw.print(" mDimColor=0x"); pw.println(Integer.toHexString(mDimColor));
|
|
pw.print(prefix); pw.print("mLastDimWidth="); pw.print(mLastDimWidth);
|
|
pw.print(" mLastDimWidth="); pw.println(mLastDimWidth);
|
|
}
|
|
}
|