summaryrefslogtreecommitdiffstats
path: root/services/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com')
-rw-r--r--services/java/com/android/server/BackupManagerService.java65
-rw-r--r--services/java/com/android/server/MountService.java57
-rw-r--r--services/java/com/android/server/SystemServer.java33
-rw-r--r--services/java/com/android/server/WifiService.java63
-rw-r--r--services/java/com/android/server/input/InputManagerService.java18
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java27
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java46
-rw-r--r--services/java/com/android/server/wm/WindowState.java3
-rw-r--r--services/java/com/android/server/wm/WindowStateAnimator.java19
9 files changed, 189 insertions, 142 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index a3768c6..2167c49 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -48,6 +48,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.database.ContentObserver;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
@@ -252,6 +253,34 @@ class BackupManagerService extends IBackupManager.Stub {
IBackupTransport mLocalTransport, mGoogleTransport;
ActiveRestoreSession mActiveRestoreSession;
+ // Watch the device provisioning operation during setup
+ ContentObserver mProvisionedObserver;
+
+ class ProvisionedObserver extends ContentObserver {
+ public ProvisionedObserver(Handler handler) {
+ super(handler);
+ }
+
+ public void onChange(boolean selfChange) {
+ final boolean wasProvisioned = mProvisioned;
+ final boolean isProvisioned = deviceIsProvisioned();
+ // latch: never unprovision
+ mProvisioned = wasProvisioned || isProvisioned;
+ if (MORE_DEBUG) {
+ Slog.d(TAG, "Provisioning change: was=" + wasProvisioned
+ + " is=" + isProvisioned + " now=" + mProvisioned);
+ }
+
+ synchronized (mQueueLock) {
+ if (mProvisioned && !wasProvisioned && mEnabled) {
+ // we're now good to go, so start the backup alarms
+ if (MORE_DEBUG) Slog.d(TAG, "Now provisioned, so starting backups");
+ startBackupAlarmsLocked(FIRST_BACKUP_INTERVAL);
+ }
+ }
+ }
+ }
+
class RestoreGetSetsParams {
public IBackupTransport transport;
public ActiveRestoreSession session;
@@ -695,12 +724,19 @@ class BackupManagerService extends IBackupManager.Stub {
mBackupHandler = new BackupHandler(mHandlerThread.getLooper());
// Set up our bookkeeping
- boolean areEnabled = Settings.Secure.getInt(context.getContentResolver(),
+ final ContentResolver resolver = context.getContentResolver();
+ boolean areEnabled = Settings.Secure.getInt(resolver,
Settings.Secure.BACKUP_ENABLED, 0) != 0;
- mProvisioned = Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.BACKUP_PROVISIONED, 0) != 0;
- mAutoRestore = Settings.Secure.getInt(context.getContentResolver(),
+ mProvisioned = Settings.Secure.getInt(resolver,
+ Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
+ mAutoRestore = Settings.Secure.getInt(resolver,
Settings.Secure.BACKUP_AUTO_RESTORE, 1) != 0;
+
+ mProvisionedObserver = new ProvisionedObserver(mBackupHandler);
+ resolver.registerContentObserver(
+ Settings.Secure.getUriFor(Settings.Secure.DEVICE_PROVISIONED),
+ false, mProvisionedObserver);
+
// If Encrypted file systems is enabled or disabled, this call will return the
// correct directory.
mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup");
@@ -5172,24 +5208,9 @@ class BackupManagerService extends IBackupManager.Stub {
public void setBackupProvisioned(boolean available) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"setBackupProvisioned");
-
- boolean wasProvisioned = mProvisioned;
- synchronized (this) {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.BACKUP_PROVISIONED, available ? 1 : 0);
- mProvisioned = available;
- }
-
- synchronized (mQueueLock) {
- if (available && !wasProvisioned && mEnabled) {
- // we're now good to go, so start the backup alarms
- startBackupAlarmsLocked(FIRST_BACKUP_INTERVAL);
- } else if (!available) {
- // No longer enabled, so stop running backups
- Slog.w(TAG, "Backup service no longer provisioned");
- mAlarmManager.cancel(mRunBackupIntent);
- }
- }
+ /*
+ * This is now a no-op; provisioning is simply the device's own setup state.
+ */
}
private void startBackupAlarmsLocked(long delayBeforeFirstBackup) {
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index d6606f6..13ab586 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -79,6 +79,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.Set;
import javax.crypto.SecretKey;
@@ -178,7 +180,8 @@ class MountService extends IMountService.Stub
final private ArrayList<MountServiceBinderListener> mListeners =
new ArrayList<MountServiceBinderListener>();
private boolean mBooted = false;
- private boolean mReady = false;
+ private CountDownLatch mConnectedSignal = new CountDownLatch(1);
+ private CountDownLatch mAsecsScanned = new CountDownLatch(1);
private boolean mSendUmsConnectedOnBoot = false;
// true if we should fake MEDIA_MOUNTED state for external storage
private boolean mEmulateExternalStorage = false;
@@ -446,15 +449,30 @@ class MountService extends IMountService.Stub
final private HandlerThread mHandlerThread;
final private Handler mHandler;
+ void waitForAsecScan() {
+ waitForLatch(mAsecsScanned);
+ }
+
private void waitForReady() {
- while (mReady == false) {
- for (int retries = 5; retries > 0; retries--) {
- if (mReady) {
+ waitForLatch(mConnectedSignal);
+ }
+
+ private void waitForLatch(CountDownLatch latch) {
+ if (latch == null) {
+ return;
+ }
+
+ for (;;) {
+ try {
+ if (latch.await(5000, TimeUnit.MILLISECONDS)) {
return;
+ } else {
+ Slog.w(TAG, "Thread " + Thread.currentThread().getName()
+ + " still waiting for MountService ready...");
}
- SystemClock.sleep(1000);
+ } catch (InterruptedException e) {
+ Slog.w(TAG, "Interrupt while waiting for MountService to be ready.");
}
- Slog.w(TAG, "Waiting too long for mReady!");
}
}
@@ -627,7 +645,7 @@ class MountService extends IMountService.Stub
* Since we'll be calling back into the NativeDaemonConnector,
* we need to do our work in a new thread.
*/
- new Thread() {
+ new Thread("MountService#onDaemonConnected") {
@Override
public void run() {
/**
@@ -668,14 +686,19 @@ class MountService extends IMountService.Stub
updatePublicVolumeState(mExternalStoragePath, Environment.MEDIA_REMOVED);
}
- // Let package manager load internal ASECs.
- mPms.updateExternalMediaStatus(true, false);
-
/*
* Now that we've done our initialization, release
* the hounds!
*/
- mReady = true;
+ mConnectedSignal.countDown();
+ mConnectedSignal = null;
+
+ // Let package manager load internal ASECs.
+ mPms.scanAvailableAsecs();
+
+ // Notify people waiting for ASECs to be scanned that it's done.
+ mAsecsScanned.countDown();
+ mAsecsScanned = null;
}
}.start();
}
@@ -1159,22 +1182,12 @@ class MountService extends IMountService.Stub
mObbActionHandler = new ObbActionHandler(mHandlerThread.getLooper());
/*
- * Vold does not run in the simulator, so pretend the connector thread
- * ran and did its thing.
- */
- if ("simulator".equals(SystemProperties.get("ro.product.device"))) {
- mReady = true;
- mUmsEnabling = true;
- return;
- }
-
- /*
* Create the connection to vold with a maximum queue of twice the
* amount of containers we'd ever expect to have. This keeps an
* "asec list" from blocking a thread repeatedly.
*/
mConnector = new NativeDaemonConnector(this, "vold", MAX_CONTAINERS * 2, VOLD_TAG, 25);
- mReady = false;
+
Thread thread = new Thread(mConnector, VOLD_TAG);
thread.start();
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index bb10358..eaecd4c 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -320,6 +320,21 @@ class ServerThread extends Thread {
}
if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) {
+ MountService mountService = null;
+ if (!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
+ try {
+ /*
+ * NotificationManagerService is dependant on MountService,
+ * (for media / usb notifications) so we must start MountService first.
+ */
+ Slog.i(TAG, "Mount Service");
+ mountService = new MountService(context);
+ ServiceManager.addService("mount", mountService);
+ } catch (Throwable e) {
+ reportWtf("starting Mount Service", e);
+ }
+ }
+
try {
Slog.i(TAG, "LockSettingsService");
lockSettings = new LockSettingsService(context);
@@ -441,17 +456,13 @@ class ServerThread extends Thread {
reportWtf("starting UpdateLockService", e);
}
- if (!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
- try {
- /*
- * NotificationManagerService is dependant on MountService,
- * (for media / usb notifications) so we must start MountService first.
- */
- Slog.i(TAG, "Mount Service");
- ServiceManager.addService("mount", new MountService(context));
- } catch (Throwable e) {
- reportWtf("starting Mount Service", e);
- }
+ /*
+ * MountService has a few dependencies: Notification Manager and
+ * AppWidget Provider. Make sure MountService is completely started
+ * first before continuing.
+ */
+ if (mountService != null) {
+ mountService.waitForAsecScan();
}
try {
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index b1558c7..1f03d17 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -376,11 +376,7 @@ public class WifiService extends IWifiManager.Stub {
@Override
public void onReceive(Context context, Intent intent) {
mAirplaneModeOn.set(isAirplaneModeOn());
- /* On airplane mode disable, restore wifi state if necessary */
- if (!mAirplaneModeOn.get() && (testAndClearWifiSavedState() ||
- mPersistWifiState.get() == WIFI_ENABLED_AIRPLANE_OVERRIDE)) {
- persistWifiState(true);
- }
+ handleAirplaneModeToggled(mAirplaneModeOn.get());
updateWifiState();
}
},
@@ -447,7 +443,10 @@ public class WifiService extends IWifiManager.Stub {
boolean wifiEnabled = shouldWifiBeEnabled() || testAndClearWifiSavedState();
Slog.i(TAG, "WifiService starting up with Wi-Fi " +
(wifiEnabled ? "enabled" : "disabled"));
- setWifiEnabled(wifiEnabled);
+
+ // If we are already disabled (could be due to airplane mode), avoid changing persist
+ // state here
+ if (wifiEnabled) setWifiEnabled(wifiEnabled);
mWifiWatchdogStateMachine = WifiWatchdogStateMachine.
makeWifiWatchdogStateMachine(mContext);
@@ -485,26 +484,43 @@ public class WifiService extends IWifiManager.Stub {
}
}
- private void persistWifiState(boolean enabled) {
- final ContentResolver cr = mContext.getContentResolver();
- boolean airplane = mAirplaneModeOn.get() && isAirplaneToggleable();
- if (enabled) {
- if (airplane) {
- mPersistWifiState.set(WIFI_ENABLED_AIRPLANE_OVERRIDE);
+ private void handleWifiToggled(boolean wifiEnabled) {
+ boolean airplaneEnabled = mAirplaneModeOn.get() && isAirplaneToggleable();
+ if (wifiEnabled) {
+ if (airplaneEnabled) {
+ persistWifiState(WIFI_ENABLED_AIRPLANE_OVERRIDE);
} else {
- mPersistWifiState.set(WIFI_ENABLED);
+ persistWifiState(WIFI_ENABLED);
}
} else {
- if (airplane) {
- mPersistWifiState.set(WIFI_DISABLED_AIRPLANE_ON);
- } else {
- mPersistWifiState.set(WIFI_DISABLED);
- }
+ // When wifi state is disabled, we do not care
+ // if airplane mode is on or not. The scenario of
+ // wifi being disabled due to airplane mode being turned on
+ // is handled handleAirplaneModeToggled()
+ persistWifiState(WIFI_DISABLED);
}
+ }
- Settings.Secure.putInt(cr, Settings.Secure.WIFI_ON, mPersistWifiState.get());
+ private void handleAirplaneModeToggled(boolean airplaneEnabled) {
+ if (airplaneEnabled) {
+ // Wifi disabled due to airplane on
+ if (mWifiEnabled) {
+ persistWifiState(WIFI_DISABLED_AIRPLANE_ON);
+ }
+ } else {
+ /* On airplane mode disable, restore wifi state if necessary */
+ if (testAndClearWifiSavedState() ||
+ mPersistWifiState.get() == WIFI_ENABLED_AIRPLANE_OVERRIDE) {
+ persistWifiState(WIFI_ENABLED);
+ }
+ }
}
+ private void persistWifiState(int state) {
+ final ContentResolver cr = mContext.getContentResolver();
+ mPersistWifiState.set(state);
+ Settings.Secure.putInt(cr, Settings.Secure.WIFI_ON, state);
+ }
/**
* see {@link android.net.wifi.WifiManager#pingSupplicant()}
@@ -578,12 +594,9 @@ public class WifiService extends IWifiManager.Stub {
* only CHANGE_WIFI_STATE is enforced
*/
- /* Avoids overriding of airplane state when wifi is already in the expected state */
- if (enable != mWifiEnabled) {
- long ident = Binder.clearCallingIdentity();
- persistWifiState(enable);
- Binder.restoreCallingIdentity(ident);
- }
+ long ident = Binder.clearCallingIdentity();
+ handleWifiToggled(enable);
+ Binder.restoreCallingIdentity(ident);
if (enable) {
if (!mIsReceiverRegistered) {
diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java
index 9e94b52..4f1f76f 100644
--- a/services/java/com/android/server/input/InputManagerService.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -37,7 +37,6 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.content.res.TypedArray;
@@ -597,8 +596,8 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
visitAllKeyboardLayouts(new KeyboardLayoutVisitor() {
@Override
public void visitKeyboardLayout(Resources resources,
- String descriptor, String label, int keyboardLayoutResId) {
- list.add(new KeyboardLayout(descriptor, label));
+ String descriptor, String label, String collection, int keyboardLayoutResId) {
+ list.add(new KeyboardLayout(descriptor, label, collection));
}
});
return list.toArray(new KeyboardLayout[list.size()]);
@@ -614,8 +613,8 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
visitKeyboardLayout(keyboardLayoutDescriptor, new KeyboardLayoutVisitor() {
@Override
public void visitKeyboardLayout(Resources resources,
- String descriptor, String label, int keyboardLayoutResId) {
- result[0] = new KeyboardLayout(descriptor, label);
+ String descriptor, String label, String collection, int keyboardLayoutResId) {
+ result[0] = new KeyboardLayout(descriptor, label, collection);
}
});
if (result[0] == null) {
@@ -663,6 +662,9 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
return;
}
+ CharSequence receiverLabel = receiver.loadLabel(pm);
+ String collection = receiverLabel != null ? receiverLabel.toString() : "";
+
try {
Resources resources = pm.getResourcesForApplication(receiver.applicationInfo);
XmlResourceParser parser = resources.getXml(configResId);
@@ -696,7 +698,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
receiver.packageName, receiver.name, name);
if (keyboardName == null || name.equals(keyboardName)) {
visitor.visitKeyboardLayout(resources, descriptor,
- label, keyboardLayoutResId);
+ label, collection, keyboardLayoutResId);
}
}
} finally {
@@ -1139,7 +1141,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
visitKeyboardLayout(keyboardLayoutDescriptor, new KeyboardLayoutVisitor() {
@Override
public void visitKeyboardLayout(Resources resources,
- String descriptor, String label, int keyboardLayoutResId) {
+ String descriptor, String label, String collection, int keyboardLayoutResId) {
try {
result[0] = descriptor;
result[1] = Streams.readFully(new InputStreamReader(
@@ -1262,7 +1264,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
private interface KeyboardLayoutVisitor {
void visitKeyboardLayout(Resources resources,
- String descriptor, String label, int keyboardLayoutResId);
+ String descriptor, String label, String collection, int keyboardLayoutResId);
}
private final class InputDevicesChangedListenerRecord implements DeathRecipient {
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 3936c18..77c3e78 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -240,6 +240,9 @@ public class PackageManagerService extends IPackageManager.Stub {
// This is where all application persistent data goes for secondary users.
final File mUserAppDataDir;
+ /** The location for ASEC container files on internal storage. */
+ final String mAsecInternalPath;
+
// This is the object monitoring the framework dir.
final FileObserver mFrameworkInstallObserver;
@@ -907,6 +910,7 @@ public class PackageManagerService extends IPackageManager.Stub {
File dataDir = Environment.getDataDirectory();
mAppDataDir = new File(dataDir, "data");
+ mAsecInternalPath = new File(dataDir, "app-asec").getPath();
mUserAppDataDir = new File(dataDir, "user");
mDrmAppPrivateInstallDir = new File(dataDir, "app-private");
@@ -1043,7 +1047,7 @@ public class PackageManagerService extends IPackageManager.Stub {
scanDirLI(mFrameworkDir, PackageParser.PARSE_IS_SYSTEM
| PackageParser.PARSE_IS_SYSTEM_DIR,
scanMode | SCAN_NO_DEX, 0);
-
+
// Collect all system packages.
mSystemAppDir = new File(Environment.getRootDirectory(), "app");
mSystemInstallObserver = new AppDirObserver(
@@ -6479,6 +6483,11 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
+ private boolean isAsecExternal(String cid) {
+ final String asecPath = PackageHelper.getSdFilesystem(cid);
+ return !asecPath.startsWith(mAsecInternalPath);
+ }
+
/**
* Extract the MountService "container ID" from the full code path of an
* .apk.
@@ -6517,7 +6526,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
AsecInstallArgs(String cid) {
- super(null, null, 0, null, null);
+ super(null, null, isAsecExternal(cid) ? PackageManager.INSTALL_EXTERNAL : 0, null, null);
this.cid = cid;
setCachePath(PackageHelper.getSdDir(cid));
}
@@ -8659,6 +8668,14 @@ public class PackageManagerService extends IPackageManager.Stub {
});
}
+ /**
+ * Called by MountService when the initial ASECs to scan are available.
+ * Should block until all the ASEC containers are finished being scanned.
+ */
+ public void scanAvailableAsecs() {
+ updateExternalMediaStatusInner(true, false);
+ }
+
/*
* Collect information of applications on external media, map them against
* existing containers and update information based on current mount status.
@@ -8793,7 +8810,11 @@ public class PackageManagerService extends IPackageManager.Stub {
continue;
}
// Parse package
- int parseFlags = PackageParser.PARSE_ON_SDCARD | mDefParseFlags;
+ int parseFlags = mDefParseFlags;
+ if (args.isExternal()) {
+ parseFlags |= PackageParser.PARSE_ON_SDCARD;
+ }
+
doGc = true;
synchronized (mInstallLock) {
final PackageParser.Package pkg = scanPackageLI(new File(codePath), parseFlags,
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index b3ac6f1..f460f9b 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -1173,8 +1173,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_INPUT_METHOD) {
Slog.i(TAG, "isVisibleOrAdding " + w + ": " + w.isVisibleOrAdding());
if (!w.isVisibleOrAdding()) {
- Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface + " reportDestroy="
- + w.mWinAnimator.mReportDestroySurface
+ Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface
+ " relayoutCalled=" + w.mRelayoutCalled + " viewVis=" + w.mViewVisibility
+ " policyVis=" + w.mPolicyVisibility + " attachHid=" + w.mAttachedHidden
+ " exiting=" + w.mExiting + " destroying=" + w.mDestroying);
@@ -2651,7 +2650,7 @@ public class WindowManagerService extends IWindowManager.Stub
int requestedHeight, int viewVisibility, int flags,
Rect outFrame, Rect outContentInsets,
Rect outVisibleInsets, Configuration outConfig, Surface outSurface) {
- boolean displayed = false;
+ boolean toBeDisplayed = false;
boolean inTouchMode;
boolean configChanged;
boolean surfaceChanged = false;
@@ -2754,7 +2753,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (viewVisibility == View.VISIBLE &&
(win.mAppToken == null || !win.mAppToken.clientHidden)) {
- displayed = !win.isVisibleLw();
+ toBeDisplayed = !win.isVisibleLw();
if (win.mExiting) {
winAnimator.cancelExitAnimationForNextAnimationLocked();
win.mExiting = false;
@@ -2766,7 +2765,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (oldVisibility == View.GONE) {
winAnimator.mEnterAnimationPending = true;
}
- if (displayed) {
+ if (toBeDisplayed) {
if (win.isDrawnLw() && okToDisplay()) {
winAnimator.applyEnterAnimationLocked();
}
@@ -2792,7 +2791,7 @@ public class WindowManagerService extends IWindowManager.Stub
if ((attrChanges&WindowManager.LayoutParams.FORMAT_CHANGED) != 0) {
// To change the format, we need to re-build the surface.
winAnimator.destroySurfaceLocked();
- displayed = true;
+ toBeDisplayed = true;
surfaceChanged = true;
}
try {
@@ -2802,8 +2801,6 @@ public class WindowManagerService extends IWindowManager.Stub
Surface surface = winAnimator.createSurfaceLocked();
if (surface != null) {
outSurface.copyFrom(surface);
- winAnimator.mReportDestroySurface = false;
- winAnimator.mSurfacePendingDestroy = false;
if (SHOW_TRANSACTIONS) Slog.i(TAG,
" OUT SURFACE " + outSurface + ": copied");
} else {
@@ -2820,7 +2817,7 @@ public class WindowManagerService extends IWindowManager.Stub
Binder.restoreCallingIdentity(origId);
return 0;
}
- if (displayed) {
+ if (toBeDisplayed) {
focusMayChange = true;
}
if (win.mAttrs.type == TYPE_INPUT_METHOD
@@ -2845,11 +2842,10 @@ public class WindowManagerService extends IWindowManager.Stub
winAnimator.mEnterAnimationPending = false;
if (winAnimator.mSurface != null) {
if (DEBUG_VISIBILITY) Slog.i(TAG, "Relayout invis " + win
- + ": mExiting=" + win.mExiting
- + " mSurfacePendingDestroy=" + winAnimator.mSurfacePendingDestroy);
+ + ": mExiting=" + win.mExiting);
// If we are not currently running the exit animation, we
// need to see about starting one.
- if (!win.mExiting || winAnimator.mSurfacePendingDestroy) {
+ if (!win.mExiting) {
surfaceChanged = true;
// Try starting an animation; if there isn't one, we
// can destroy the surface right away.
@@ -2857,7 +2853,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE;
}
- if (!winAnimator.mSurfacePendingDestroy && win.isWinVisibleLw() &&
+ if (win.isWinVisibleLw() &&
winAnimator.applyAnimationLocked(transit, false)) {
focusMayChange = true;
win.mExiting = true;
@@ -2880,22 +2876,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- if (winAnimator.mSurface == null || (win.getAttrs().flags
- & WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING) == 0
- || winAnimator.mSurfacePendingDestroy) {
- // We could be called from a local process, which
- // means outSurface holds its current surface. Ensure the
- // surface object is cleared, but we don't necessarily want
- // it actually destroyed at this point.
- winAnimator.mSurfacePendingDestroy = false;
- outSurface.release();
- if (DEBUG_VISIBILITY) Slog.i(TAG, "Releasing surface in: " + win);
- } else if (winAnimator.mSurface != null) {
- if (DEBUG_VISIBILITY) Slog.i(TAG,
- "Keeping surface, will report destroy: " + win);
- winAnimator.mReportDestroySurface = true;
- outSurface.copyFrom(winAnimator.mSurface);
- }
+ outSurface.release();
+ if (DEBUG_VISIBILITY) Slog.i(TAG, "Releasing surface in: " + win);
}
if (focusMayChange) {
@@ -2912,7 +2894,7 @@ public class WindowManagerService extends IWindowManager.Stub
boolean assignLayers = false;
if (imMayMove) {
- if (moveInputMethodWindowsIfNeededLocked(false) || displayed) {
+ if (moveInputMethodWindowsIfNeededLocked(false) || toBeDisplayed) {
// Little hack here -- we -should- be able to rely on the
// function to return true if the IME has moved and needs
// its layer recomputed. However, if the IME was hidden
@@ -2934,7 +2916,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
configChanged = updateOrientationFromAppTokensLocked(false);
performLayoutAndPlaceSurfacesLocked();
- if (displayed && win.mIsWallpaper) {
+ if (toBeDisplayed && win.mIsWallpaper) {
updateWallpaperOffsetLocked(win, mAppDisplayWidth, mAppDisplayHeight, false);
}
if (win.mAppToken != null) {
@@ -2970,7 +2952,7 @@ public class WindowManagerService extends IWindowManager.Stub
Binder.restoreCallingIdentity(origId);
return (inTouchMode ? WindowManagerImpl.RELAYOUT_RES_IN_TOUCH_MODE : 0)
- | (displayed ? WindowManagerImpl.RELAYOUT_RES_FIRST_TIME : 0)
+ | (toBeDisplayed ? WindowManagerImpl.RELAYOUT_RES_FIRST_TIME : 0)
| (surfaceChanged ? WindowManagerImpl.RELAYOUT_RES_SURFACE_CHANGED : 0)
| (animating ? WindowManagerImpl.RELAYOUT_RES_ANIMATING : 0);
}
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 1fd80c2..e2a904f 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -679,8 +679,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
*/
boolean isVisibleOrAdding() {
final AppWindowToken atoken = mAppToken;
- return ((mHasSurface && !mWinAnimator.mReportDestroySurface)
- || (!mRelayoutCalled && mViewVisibility == View.VISIBLE))
+ return (mHasSurface || (!mRelayoutCalled && mViewVisibility == View.VISIBLE))
&& mPolicyVisibility && !mAttachedHidden
&& (atoken == null || !atoken.hiddenRequested)
&& !mExiting && !mDestroying;
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 5516dea..355db6e 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -71,8 +71,6 @@ class WindowStateAnimator {
Surface mSurface;
Surface mPendingDestroySurface;
- boolean mReportDestroySurface;
- boolean mSurfacePendingDestroy;
/**
* Set when we have changed the size of the surface, to know that
@@ -561,8 +559,6 @@ class WindowStateAnimator {
Surface createSurfaceLocked() {
if (mSurface == null) {
- mReportDestroySurface = false;
- mSurfacePendingDestroy = false;
if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.i(TAG,
"createSurface " + this + ": mDrawState=DRAW_PENDING");
mDrawState = DRAW_PENDING;
@@ -694,7 +690,6 @@ class WindowStateAnimator {
mWin.mAppToken.startingDisplayed = false;
}
- mDrawState = NO_SURFACE;
if (mSurface != null) {
int i = mWin.mChildWindows.size();
@@ -704,17 +699,6 @@ class WindowStateAnimator {
c.mAttachedHidden = true;
}
- if (mReportDestroySurface) {
- mReportDestroySurface = false;
- mSurfacePendingDestroy = true;
- try {
- mWin.mClient.dispatchGetNewSurface();
- // We'll really destroy on the next time around.
- return;
- } catch (RemoteException e) {
- }
- }
-
try {
if (DEBUG_VISIBILITY) {
RuntimeException e = null;
@@ -760,6 +744,7 @@ class WindowStateAnimator {
mSurfaceShown = false;
mSurface = null;
mWin.mHasSurface =false;
+ mDrawState = NO_SURFACE;
}
}
@@ -1147,7 +1132,7 @@ class WindowStateAnimator {
}
} else {
if (DEBUG_ANIM) {
- Slog.v(TAG, "prepareSurface: No changes in animation for " + mWin);
+ // Slog.v(TAG, "prepareSurface: No changes in animation for " + mWin);
}
displayed = true;
}