diff options
Diffstat (limited to 'services')
8 files changed, 130 insertions, 35 deletions
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java index 349b4d2..c517965 100644 --- a/services/java/com/android/server/NetworkManagementService.java +++ b/services/java/com/android/server/NetworkManagementService.java @@ -480,6 +480,20 @@ public class NetworkManagementService extends INetworkManagementService.Stub } } + public void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable) + throws IllegalStateException { + String cmd = String.format("interface ipv6privacyextensions %s %s", iface, + enable ? "enable" : "disable"); + try { + mConnector.doCommand(cmd); + } catch (NativeDaemonConnectorException e) { + throw new IllegalStateException( + "Unable to communicate with native daemon to set ipv6privacyextensions - " + e); + } + } + + + /* TODO: This is right now a IPv4 only function. Works for wifi which loses its IPv6 addresses on interface down, but we need to do full clean up here */ public void clearInterfaceAddresses(String iface) throws IllegalStateException { diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index bbc26d6..bb21d81 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -235,6 +235,7 @@ public class PowerManagerService extends IPowerManager.Stub private boolean mPreventScreenOn; private int mScreenBrightnessOverride = -1; private int mButtonBrightnessOverride = -1; + private int mScreenBrightnessDim; private boolean mUseSoftwareAutoBrightness; private boolean mAutoBrightessEnabled; private int[] mAutoBrightnessLevels; @@ -586,6 +587,9 @@ public class PowerManagerService extends IPowerManager.Stub mUnplugTurnsOnScreen = resources.getBoolean( com.android.internal.R.bool.config_unplugTurnsOnScreen); + mScreenBrightnessDim = resources.getInteger( + com.android.internal.R.integer.config_screenBrightnessDim); + // read settings for auto-brightness mUseSoftwareAutoBrightness = resources.getBoolean( com.android.internal.R.bool.config_automatic_brightness_available); @@ -1880,7 +1884,7 @@ public class PowerManagerService extends IPowerManager.Stub nominalCurrentValue = preferredBrightness; break; case SCREEN_ON_BIT: - nominalCurrentValue = Power.BRIGHTNESS_DIM; + nominalCurrentValue = mScreenBrightnessDim; break; case 0: nominalCurrentValue = Power.BRIGHTNESS_OFF; @@ -1899,7 +1903,7 @@ public class PowerManagerService extends IPowerManager.Stub // the scale is because the brightness ramp isn't linear and this biases // it so the later parts take longer. final float scale = 1.5f; - float ratio = (((float)Power.BRIGHTNESS_DIM)/preferredBrightness); + float ratio = (((float)mScreenBrightnessDim)/preferredBrightness); if (ratio > 1.0f) ratio = 1.0f; if ((newState & SCREEN_ON_BIT) == 0) { if ((oldState & SCREEN_BRIGHT_BIT) != 0) { @@ -1926,7 +1930,7 @@ public class PowerManagerService extends IPowerManager.Stub // will then count going dim as turning off. mScreenOffTime = SystemClock.elapsedRealtime(); } - brightness = Power.BRIGHTNESS_DIM; + brightness = mScreenBrightnessDim; } } long identity = Binder.clearCallingIdentity(); @@ -1956,7 +1960,7 @@ public class PowerManagerService extends IPowerManager.Stub setLightBrightness(offMask, Power.BRIGHTNESS_OFF); } if (dimMask != 0) { - int brightness = Power.BRIGHTNESS_DIM; + int brightness = mScreenBrightnessDim; if ((newState & BATTERY_LOW_BIT) != 0 && brightness > Power.BRIGHTNESS_LOW_BATTERY) { brightness = Power.BRIGHTNESS_LOW_BATTERY; @@ -2122,7 +2126,7 @@ public class PowerManagerService extends IPowerManager.Stub final int brightness = Settings.System.getInt(mContext.getContentResolver(), SCREEN_BRIGHTNESS); // Don't let applications turn the screen all the way off - return Math.max(brightness, Power.BRIGHTNESS_DIM); + return Math.max(brightness, mScreenBrightnessDim); } catch (SettingNotFoundException snfe) { return Power.BRIGHTNESS_ON; } @@ -2810,7 +2814,7 @@ public class PowerManagerService extends IPowerManager.Stub mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null); // Don't let applications turn the screen all the way off synchronized (mLocks) { - brightness = Math.max(brightness, Power.BRIGHTNESS_DIM); + brightness = Math.max(brightness, mScreenBrightnessDim); mLcdLight.setBrightness(brightness); mKeyboardLight.setBrightness(mKeyboardVisible ? brightness : 0); mButtonLight.setBrightness(brightness); diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 4b1a4e6..883fc71 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -37,7 +37,7 @@ import android.net.wifi.WifiStateMachine; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiWatchdogStateMachine; import android.net.wifi.WifiConfiguration.KeyMgmt; -import android.net.wifi.Wps; +import android.net.wifi.WpsInfo; import android.net.wifi.WpsResult; import android.net.ConnectivityManager; import android.net.DhcpInfo; @@ -288,7 +288,7 @@ public class WifiService extends IWifiManager.Stub { } case WifiManager.CMD_START_WPS: { //replyTo has the original source - mWifiStateMachine.startWps(msg.replyTo, (Wps)msg.obj); + mWifiStateMachine.startWps(msg.replyTo, (WpsInfo)msg.obj); break; } case WifiManager.CMD_DISABLE_NETWORK: { diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index 09ddc2f..10d384b 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -190,6 +190,22 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub } @Override + public void onPackageRemoved(String packageName, int uid) { + synchronized (mLock) { + Iterator<ComponentName> it = mEnabledServices.iterator(); + while (it.hasNext()) { + ComponentName comp = it.next(); + String compPkg = comp.getPackageName(); + if (compPkg.equals(packageName)) { + it.remove(); + updateEnabledAccessibilitySerivcesSettingLocked(mEnabledServices); + return; + } + } + } + } + + @Override public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) { synchronized (mLock) { @@ -209,23 +225,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub } } if (changed) { - it = mEnabledServices.iterator(); - StringBuilder str = new StringBuilder(); - while (it.hasNext()) { - if (str.length() > 0) { - str.append(':'); - } - str.append(it.next().flattenToShortString()); - } - Settings.Secure.putString(mContext.getContentResolver(), - Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, - str.toString()); - manageServicesLocked(); + updateEnabledAccessibilitySerivcesSettingLocked(mEnabledServices); } return false; } } - + @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) { @@ -252,6 +257,21 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub super.onReceive(context, intent); } + + private void updateEnabledAccessibilitySerivcesSettingLocked( + Set<ComponentName> enabledServices) { + Iterator<ComponentName> it = enabledServices.iterator(); + StringBuilder str = new StringBuilder(); + while (it.hasNext()) { + if (str.length() > 0) { + str.append(':'); + } + str.append(it.next().flattenToShortString()); + } + Settings.Secure.putString(mContext.getContentResolver(), + Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, + str.toString()); + } }; // package changes @@ -697,6 +717,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub private void manageServicesLocked() { populateEnabledServicesLocked(mEnabledServices); updateServicesStateLocked(mInstalledServices, mEnabledServices); + disableAccessibilityIfNoEnabledServices(mEnabledServices); } /** @@ -781,6 +802,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub } /** + * Disables accessibility if there are no enabled accessibility services which + * to consume the generated accessibility events. + * + * @param enabledServices The set of enabled services. + */ + private void disableAccessibilityIfNoEnabledServices(Set<ComponentName> enabledServices) { + if (enabledServices.isEmpty()) { + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_ENABLED, 0); + } + } + + /** * Sends the state to the clients. */ private void sendStateToClientsLocked() { diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 4e5ca8e..9ebdd52 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -71,6 +71,7 @@ import android.content.pm.ServiceInfo; import android.content.pm.Signature; import android.content.pm.UserInfo; import android.content.pm.ManifestDigest; +import android.content.pm.VerifierDeviceIdentity; import android.net.Uri; import android.os.Binder; import android.os.Build; @@ -8405,4 +8406,15 @@ public class PackageManagerService extends IPackageManager.Stub { mUserManager.removeUser(userId); return true; } + + @Override + public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException { + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.PACKAGE_VERIFICATION_AGENT, + "Only package verification agents can read the verifier device identity"); + + synchronized (mPackages) { + return mSettings.getVerifierDeviceIdentityLPw(); + } + } } diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java index f270003..7cdb5b1 100644 --- a/services/java/com/android/server/pm/Settings.java +++ b/services/java/com/android/server/pm/Settings.java @@ -39,6 +39,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PermissionInfo; import android.content.pm.Signature; +import android.content.pm.VerifierDeviceIdentity; import android.os.Binder; import android.os.Environment; import android.os.FileUtils; @@ -86,7 +87,10 @@ final class Settings { // used to grant newer permissions one time during a system upgrade. int mInternalSdkPlatform; int mExternalSdkPlatform; - + + /** Device identity for the purpose of package verification. */ + private VerifierDeviceIdentity mVerifierDeviceIdentity; + // The user's preferred activities associated with particular intent // filters. final IntentResolver<PreferredActivity, PreferredActivity> mPreferredActivities = @@ -865,6 +869,12 @@ final class Settings { serializer.attribute(null, "external", Integer.toString(mExternalSdkPlatform)); serializer.endTag(null, "last-platform-version"); + if (mVerifierDeviceIdentity != null) { + serializer.startTag(null, "verifier"); + serializer.attribute(null, "device", mVerifierDeviceIdentity.toString()); + serializer.endTag(null, "verifier"); + } + serializer.startTag(null, "permission-trees"); for (BasePermission bp : mPermissionTrees.values()) { writePermissionLPr(serializer, bp); @@ -1280,6 +1290,14 @@ final class Settings { } } catch (NumberFormatException e) { } + } else if (tagName.equals("verifier")) { + final String deviceIdentity = parser.getAttributeValue(null, "device"); + try { + mVerifierDeviceIdentity = VerifierDeviceIdentity.parse(deviceIdentity); + } catch (IllegalArgumentException e) { + Slog.w(PackageManagerService.TAG, "Discard invalid verifier device id: " + + e.getMessage()); + } } else { Slog.w(PackageManagerService.TAG, "Unknown element under <packages>: " + parser.getName()); @@ -1894,6 +1912,16 @@ final class Settings { return PackageManagerService.FIRST_APPLICATION_UID + N; } + public VerifierDeviceIdentity getVerifierDeviceIdentityLPw() { + if (mVerifierDeviceIdentity == null) { + mVerifierDeviceIdentity = VerifierDeviceIdentity.generate(); + + writeLPr(); + } + + return mVerifierDeviceIdentity; + } + public PackageSetting getDisabledSystemPkgLPr(String name) { PackageSetting ps = mDisabledSysPackages.get(name); return ps; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 5a7fc9f..609016b 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -5701,8 +5701,8 @@ public class WindowManagerService extends IWindowManager.Stub return config; } - private int reduceConfigWidthSize(int curSize, int rotation, float density, int dw) { - int size = (int)(mPolicy.getConfigDisplayWidth(rotation, dw) / density); + private int reduceConfigWidthSize(int curSize, int rotation, float density, int dw, int dh) { + int size = (int)(mPolicy.getConfigDisplayWidth(dw, dh, rotation) / density); if (size < curSize) { curSize = size; } @@ -5722,17 +5722,17 @@ public class WindowManagerService extends IWindowManager.Stub unrotDw = dw; unrotDh = dh; } - int sw = reduceConfigWidthSize(unrotDw, Surface.ROTATION_0, density, unrotDw); - sw = reduceConfigWidthSize(sw, Surface.ROTATION_90, density, unrotDh); - sw = reduceConfigWidthSize(sw, Surface.ROTATION_180, density, unrotDw); - sw = reduceConfigWidthSize(sw, Surface.ROTATION_270, density, unrotDh); + int sw = reduceConfigWidthSize(unrotDw, Surface.ROTATION_0, density, unrotDw, unrotDh); + sw = reduceConfigWidthSize(sw, Surface.ROTATION_90, density, unrotDw, unrotDh); + sw = reduceConfigWidthSize(sw, Surface.ROTATION_180, density, unrotDw, unrotDh); + sw = reduceConfigWidthSize(sw, Surface.ROTATION_270, density, unrotDw, unrotDh); return sw; } private int reduceCompatConfigWidthSize(int curSize, int rotation, DisplayMetrics dm, int dw, int dh) { - dm.noncompatWidthPixels = mPolicy.getNonDecorDisplayWidth(rotation, dw); - dm.noncompatHeightPixels = mPolicy.getNonDecorDisplayHeight(rotation, dh); + dm.noncompatWidthPixels = mPolicy.getNonDecorDisplayWidth(dw, dh, rotation); + dm.noncompatHeightPixels = mPolicy.getNonDecorDisplayHeight(dw, dh, rotation); float scale = CompatibilityInfo.computeCompatibleScaling(dm, null); int size = (int)(((dm.noncompatWidthPixels / scale) / dm.density) + .5f); if (curSize == 0 || size < curSize) { @@ -5809,15 +5809,17 @@ public class WindowManagerService extends IWindowManager.Stub // Update application display metrics. final DisplayMetrics dm = mDisplayMetrics; - mAppDisplayWidth = mPolicy.getNonDecorDisplayWidth(mRotation, dw); - mAppDisplayHeight = mPolicy.getNonDecorDisplayHeight(mRotation, dh); + mAppDisplayWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation); + mAppDisplayHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation); mDisplay.getMetricsWithSize(dm, mAppDisplayWidth, mAppDisplayHeight); mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm, mCompatDisplayMetrics); - config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(mRotation, dw) / dm.density); - config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(mRotation, dh) / dm.density); + config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(dw, dh, mRotation) + / dm.density); + config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(dw, dh, mRotation) + / dm.density); config.smallestScreenWidthDp = computeSmallestWidth(rotated, dw, dh, dm.density); config.compatScreenWidthDp = (int)(config.screenWidthDp / mCompatibleScreenScale); @@ -7151,7 +7153,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_LAYOUT) Slog.v(TAG, "performLayout: needed=" + mLayoutNeeded + " dw=" + dw + " dh=" + dh); - mPolicy.beginLayoutLw(dw, dh); + mPolicy.beginLayoutLw(dw, dh, mRotation); int seq = mLayoutSeq+1; if (seq < 0) seq = 0; diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index bb36d3a..0ee3f17 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -968,6 +968,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { + mPolicyVisibilityAfterAnim); } mPolicyVisibility = mPolicyVisibilityAfterAnim; + mService.mLayoutNeeded = true; if (!mPolicyVisibility) { if (mService.mCurrentFocus == this) { mService.mFocusMayChange = true; |