diff options
Diffstat (limited to 'services/java')
11 files changed, 76 insertions, 22 deletions
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java index ab70e6f..7ecd2c0 100644 --- a/services/java/com/android/server/DevicePolicyManagerService.java +++ b/services/java/com/android/server/DevicePolicyManagerService.java @@ -1664,7 +1664,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (realQuality < quality && quality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) { Slog.w(TAG, "resetPassword: password quality 0x" - + Integer.toHexString(quality) + + Integer.toHexString(realQuality) + " does not meet required quality 0x" + Integer.toHexString(quality)); return false; diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 1dd5fc6..c916857 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1500,7 +1500,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (mStatusBar != null) { mStatusBar.setImeWindowStatus(token, vis, backDisposition); } - final boolean iconVisibility = (vis & InputMethodService.IME_ACTIVE) != 0; + final boolean iconVisibility = ((vis & (InputMethodService.IME_ACTIVE)) != 0) + && (mWindowManagerService.isHardKeyboardAvailable() + || (vis & (InputMethodService.IME_VISIBLE)) != 0); final InputMethodInfo imi = mMethodMap.get(mCurMethodId); if (imi != null && iconVisibility && needsToShowImeSwitchOngoingNotification()) { // Used to load label diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java index f402f4b..e670ef9 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -860,7 +860,7 @@ class MountService extends IMountService.Stub if (DEBUG_EVENTS) Slog.i(TAG, "Sending unmounted event first"); /* Send the media unmounted event first */ updatePublicVolumeState(volume, Environment.MEDIA_UNMOUNTED); - action = Intent.ACTION_MEDIA_UNMOUNTED; + sendStorageIntent(Intent.ACTION_MEDIA_UNMOUNTED, volume, UserHandle.ALL); if (DEBUG_EVENTS) Slog.i(TAG, "Sending media bad removal"); updatePublicVolumeState(volume, Environment.MEDIA_BAD_REMOVAL); diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java index 47840e0..0a91919 100644 --- a/services/java/com/android/server/NativeDaemonConnector.java +++ b/services/java/com/android/server/NativeDaemonConnector.java @@ -28,12 +28,12 @@ import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.google.android.collect.Lists; -import java.nio.charset.Charsets; import java.io.FileDescriptor; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.ArrayBlockingQueue; @@ -142,7 +142,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo for (int i = 0; i < count; i++) { if (buffer[i] == 0) { final String rawEvent = new String( - buffer, start, i - start, Charsets.UTF_8); + buffer, start, i - start, StandardCharsets.UTF_8); log("RCV <- {" + rawEvent + "}"); try { @@ -163,7 +163,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo } } if (start == 0) { - final String rawEvent = new String(buffer, start, count, Charsets.UTF_8); + final String rawEvent = new String(buffer, start, count, StandardCharsets.UTF_8); log("RCV incomplete <- {" + rawEvent + "}"); } @@ -352,7 +352,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo throw new NativeDaemonConnectorException("missing output stream"); } else { try { - mOutputStream.write(rawCmd.getBytes(Charsets.UTF_8)); + mOutputStream.write(rawCmd.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new NativeDaemonConnectorException("problem sending command", e); } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 0081dfc..db01655 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -6334,6 +6334,7 @@ public final class ActivityManagerService extends ActivityManagerNative // it runs in the process of the default user. Get rid of it. providers.remove(i); N--; + i--; continue; } diff --git a/services/java/com/android/server/connectivity/Vpn.java b/services/java/com/android/server/connectivity/Vpn.java index e7d1fa4..2fc972f 100644 --- a/services/java/com/android/server/connectivity/Vpn.java +++ b/services/java/com/android/server/connectivity/Vpn.java @@ -72,7 +72,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.Inet4Address; import java.net.InetAddress; -import java.nio.charset.Charsets; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.concurrent.atomic.AtomicInteger; @@ -499,15 +499,15 @@ public class Vpn extends BaseNetworkStateTracker { if (!profile.ipsecUserCert.isEmpty()) { privateKey = Credentials.USER_PRIVATE_KEY + profile.ipsecUserCert; byte[] value = keyStore.get(Credentials.USER_CERTIFICATE + profile.ipsecUserCert); - userCert = (value == null) ? null : new String(value, Charsets.UTF_8); + userCert = (value == null) ? null : new String(value, StandardCharsets.UTF_8); } if (!profile.ipsecCaCert.isEmpty()) { byte[] value = keyStore.get(Credentials.CA_CERTIFICATE + profile.ipsecCaCert); - caCert = (value == null) ? null : new String(value, Charsets.UTF_8); + caCert = (value == null) ? null : new String(value, StandardCharsets.UTF_8); } if (!profile.ipsecServerCert.isEmpty()) { byte[] value = keyStore.get(Credentials.USER_CERTIFICATE + profile.ipsecServerCert); - serverCert = (value == null) ? null : new String(value, Charsets.UTF_8); + serverCert = (value == null) ? null : new String(value, StandardCharsets.UTF_8); } if (privateKey == null || userCert == null || caCert == null || serverCert == null) { throw new IllegalStateException("Cannot load credentials"); @@ -819,7 +819,7 @@ public class Vpn extends BaseNetworkStateTracker { // Send over the arguments. OutputStream out = mSockets[i].getOutputStream(); for (String argument : arguments) { - byte[] bytes = argument.getBytes(Charsets.UTF_8); + byte[] bytes = argument.getBytes(StandardCharsets.UTF_8); if (bytes.length >= 0xFFFF) { throw new IllegalArgumentException("Argument is too large"); } diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 22ce284..8cdca1f 100644..100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -3532,10 +3532,13 @@ public class PackageManagerService extends IPackageManager.Stub { } // The apk is forward locked (not public) if its code and resources - // are kept in different files. + // are kept in different files. (except for app in either system or + // vendor path). // TODO grab this value from PackageSettings - if (ps != null && !ps.codePath.equals(ps.resourcePath)) { - parseFlags |= PackageParser.PARSE_FORWARD_LOCK; + if ((parseFlags & PackageParser.PARSE_IS_SYSTEM_DIR) == 0) { + if (ps != null && !ps.codePath.equals(ps.resourcePath)) { + parseFlags |= PackageParser.PARSE_FORWARD_LOCK; + } } String codePath = null; diff --git a/services/java/com/android/server/pm/SELinuxMMAC.java b/services/java/com/android/server/pm/SELinuxMMAC.java index 4bbdb5e..04f43d9 100644 --- a/services/java/com/android/server/pm/SELinuxMMAC.java +++ b/services/java/com/android/server/pm/SELinuxMMAC.java @@ -57,7 +57,7 @@ public final class SELinuxMMAC { // Locations of potential install policy files. private static final File[] INSTALL_POLICY_FILE = { - new File(Environment.getDataDirectory(), "system/mac_permissions.xml"), + new File(Environment.getDataDirectory(), "security/mac_permissions.xml"), new File(Environment.getRootDirectory(), "etc/security/mac_permissions.xml"), null}; diff --git a/services/java/com/android/server/power/ShutdownThread.java b/services/java/com/android/server/power/ShutdownThread.java index c7f7390..c084666 100644 --- a/services/java/com/android/server/power/ShutdownThread.java +++ b/services/java/com/android/server/power/ShutdownThread.java @@ -297,7 +297,9 @@ public final class ShutdownThread extends Thread { // First send the high-level shut down broadcast. mActionDone = false; - mContext.sendOrderedBroadcastAsUser(new Intent(Intent.ACTION_SHUTDOWN), + Intent intent = new Intent(Intent.ACTION_SHUTDOWN); + intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); + mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, null, br, mHandler, 0, null, null); final long endTime = SystemClock.elapsedRealtime() + MAX_BROADCAST_TIME; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 1399c16..0755281 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -8965,10 +8965,31 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION && winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i( TAG, "Resizing " + win + " WITH DRAW PENDING"); - win.mClient.resized(win.mFrame, win.mLastOverscanInsets, win.mLastContentInsets, - win.mLastVisibleInsets, - winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING, - configChanged ? win.mConfiguration : null); + final IWindow client = win.mClient; + final Rect frame = win.mFrame; + final Rect overscanInsets = win.mLastOverscanInsets; + final Rect contentInsets = win.mLastContentInsets; + final Rect visibleInsets = win.mLastVisibleInsets; + final boolean reportDraw + = winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING; + final Configuration newConfig = configChanged ? win.mConfiguration : null; + if (win.mClient instanceof IWindow.Stub) { + // To prevent deadlock simulate one-way call if win.mClient is a local object. + mH.post(new Runnable() { + @Override + public void run() { + try { + client.resized(frame, overscanInsets, contentInsets, + visibleInsets, reportDraw, newConfig); + } catch (RemoteException e) { + // Not a remote call, RemoteException won't be raised. + } + } + }); + } else { + client.resized(frame, overscanInsets, contentInsets, visibleInsets, reportDraw, + newConfig); + } win.mOverscanInsetsChanged = false; win.mContentInsetsChanged = false; win.mVisibleInsetsChanged = false; diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index dfb22a7..da15856 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -361,7 +361,32 @@ final class WindowState implements WindowManagerPolicy.WindowState { mSubLayer = mPolicy.subWindowTypeToLayerLw(a.type); mAttachedWindow = attachedWindow; if (WindowManagerService.DEBUG_ADD_REMOVE) Slog.v(TAG, "Adding " + this + " to " + mAttachedWindow); - mAttachedWindow.mChildWindows.add(this); + + int children_size = mAttachedWindow.mChildWindows.size(); + if (children_size == 0) { + mAttachedWindow.mChildWindows.add(this); + } else { + for (int i = 0; i < children_size; i++) { + WindowState child = (WindowState)mAttachedWindow.mChildWindows.get(i); + if (this.mSubLayer < child.mSubLayer) { + mAttachedWindow.mChildWindows.add(i, this); + break; + } else if (this.mSubLayer > child.mSubLayer) { + continue; + } + + if (this.mBaseLayer <= child.mBaseLayer) { + mAttachedWindow.mChildWindows.add(i, this); + break; + } else { + continue; + } + } + if (children_size == mAttachedWindow.mChildWindows.size()) { + mAttachedWindow.mChildWindows.add(this); + } + } + mLayoutAttached = mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; mIsImWindow = attachedWindow.mAttrs.type == TYPE_INPUT_METHOD |