summaryrefslogtreecommitdiffstats
path: root/services/java/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android')
-rw-r--r--services/java/com/android/server/DevicePolicyManagerService.java2
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java4
-rw-r--r--services/java/com/android/server/MountService.java2
-rw-r--r--services/java/com/android/server/NativeDaemonConnector.java8
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java1
-rw-r--r--services/java/com/android/server/connectivity/Nat464Xlat.java19
-rw-r--r--services/java/com/android/server/connectivity/Vpn.java23
-rwxr-xr-x[-rw-r--r--]services/java/com/android/server/pm/PackageManagerService.java9
-rw-r--r--services/java/com/android/server/pm/SELinuxMMAC.java2
-rw-r--r--services/java/com/android/server/power/ShutdownThread.java4
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java39
-rw-r--r--services/java/com/android/server/wm/WindowState.java27
12 files changed, 100 insertions, 40 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/Nat464Xlat.java b/services/java/com/android/server/connectivity/Nat464Xlat.java
index 59403c5..a15d678 100644
--- a/services/java/com/android/server/connectivity/Nat464Xlat.java
+++ b/services/java/com/android/server/connectivity/Nat464Xlat.java
@@ -147,17 +147,24 @@ public class Nat464Xlat extends BaseNetworkObserver {
" added, mIsRunning = " + mIsRunning + " -> true");
mIsRunning = true;
- // Get the network configuration of the clat interface, store it
- // in our link properties, and stack it on top of the interface
- // it's running on.
+ // Create the LinkProperties for the clat interface by fetching the
+ // IPv4 address for the interface and adding an IPv4 default route,
+ // then stack the LinkProperties on top of the link it's running on.
+ // Although the clat interface is a point-to-point tunnel, we don't
+ // point the route directly at the interface because some apps don't
+ // understand routes without gateways (see, e.g., http://b/9597256
+ // http://b/9597516). Instead, set the next hop of the route to the
+ // clat IPv4 address itself (for those apps, it doesn't matter what
+ // the IP of the gateway is, only that there is one).
try {
InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
+ LinkAddress clatAddress = config.getLinkAddress();
mLP.clear();
mLP.setInterfaceName(iface);
- RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0), null,
- iface);
+ RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0),
+ clatAddress.getAddress(), iface);
mLP.addRoute(ipv4Default);
- mLP.addLinkAddress(config.getLinkAddress());
+ mLP.addLinkAddress(clatAddress);
mTracker.addStackedLink(mLP);
Slog.i(TAG, "Adding stacked link. tracker LP: " +
mTracker.getLinkProperties());
diff --git a/services/java/com/android/server/connectivity/Vpn.java b/services/java/com/android/server/connectivity/Vpn.java
index e7d1fa4..63d3958 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;
@@ -467,15 +467,15 @@ public class Vpn extends BaseNetworkStateTracker {
private native int jniCheck(String interfaze);
private native void jniProtect(int socket, String interfaze);
- private static String findLegacyVpnGateway(LinkProperties prop) {
- for (RouteInfo route : prop.getRoutes()) {
+ private static RouteInfo findIPv4DefaultRoute(LinkProperties prop) {
+ for (RouteInfo route : prop.getAllRoutes()) {
// Currently legacy VPN only works on IPv4.
if (route.isDefaultRoute() && route.getGateway() instanceof Inet4Address) {
- return route.getGateway().getHostAddress();
+ return route;
}
}
- throw new IllegalStateException("Unable to find suitable gateway");
+ throw new IllegalStateException("Unable to find IPv4 default gateway");
}
/**
@@ -488,8 +488,9 @@ public class Vpn extends BaseNetworkStateTracker {
throw new IllegalStateException("KeyStore isn't unlocked");
}
- final String iface = egress.getInterfaceName();
- final String gateway = findLegacyVpnGateway(egress);
+ final RouteInfo ipv4DefaultRoute = findIPv4DefaultRoute(egress);
+ final String gateway = ipv4DefaultRoute.getGateway().getHostAddress();
+ final String iface = ipv4DefaultRoute.getInterface();
// Load certificates.
String privateKey = "";
@@ -499,15 +500,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 +820,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..ce40e73 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -4879,13 +4879,11 @@ public class WindowManagerService extends IWindowManager.Stub
throw new SecurityException("Requires SET_ANIMATION_SCALE permission");
}
- if (scale < 0) scale = 0;
- else if (scale > 20) scale = 20;
- scale = Math.abs(scale);
+ scale = fixScale(scale);
switch (which) {
- case 0: mWindowAnimationScale = fixScale(scale); break;
- case 1: mTransitionAnimationScale = fixScale(scale); break;
- case 2: mAnimatorDurationScale = fixScale(scale); break;
+ case 0: mWindowAnimationScale = scale; break;
+ case 1: mTransitionAnimationScale = scale; break;
+ case 2: mAnimatorDurationScale = scale; break;
}
// Persist setting
@@ -8965,10 +8963,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