diff options
Diffstat (limited to 'services/java/com/android')
9 files changed, 160 insertions, 41 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 3815c3b..2348d76 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -703,6 +703,12 @@ public class ConnectivityService extends IConnectivityManager.Stub { return result.toArray(new NetworkInfo[result.size()]); } + @Override + public boolean isNetworkSupported(int networkType) { + enforceAccessPermission(); + return (isNetworkTypeValid(networkType) && (mNetTrackers[networkType] != null)); + } + /** * Return LinkProperties for the active (i.e., connected) default * network interface. It is assumed that at most one default network diff --git a/services/java/com/android/server/EventLogTags.logtags b/services/java/com/android/server/EventLogTags.logtags index 5429c0c..f0b5958 100644 --- a/services/java/com/android/server/EventLogTags.logtags +++ b/services/java/com/android/server/EventLogTags.logtags @@ -137,3 +137,10 @@ option java_package com.android.server # [ 8- 3] Detailed state ordinal (as defined by NetworkInfo.DetailedState) # [ 2- 0] Network type (as defined by ConnectivityManager) 50020 connectivity_state_changed (custom|1|5) + + +# --------------------------- +# NetworkStatsService.java +# --------------------------- +51100 netstats_mobile_sample (iface_rx|2|2),(iface_tx|2|2),(uid_rx|2|2),(uid_tx|2|2) +51101 netstats_wifi_sample (iface_rx|2|2),(iface_tx|2|2),(uid_rx|2|2),(uid_tx|2|2) diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index bb831f5..0e1a1e3 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -655,7 +655,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub List<InputMethodSubtype> enabledSubtypes = mSettings.getEnabledInputMethodSubtypeListLocked(imi); if (allowsImplicitlySelectedSubtypes && enabledSubtypes.isEmpty()) { - enabledSubtypes = getApplicableSubtypesLocked(mRes, getSubtypes(imi)); + enabledSubtypes = getImplicitlyApplicableSubtypesLocked(mRes, imi); } return InputMethodSubtype.sort(mContext, 0, imi, enabledSubtypes); } @@ -1668,13 +1668,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } @Override - public boolean setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) { + public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) { // By this IPC call, only a process which shares the same uid with the IME can add // additional input method subtypes to the IME. - if (TextUtils.isEmpty(imiId) || subtypes == null || subtypes.length == 0) return false; + if (TextUtils.isEmpty(imiId) || subtypes == null || subtypes.length == 0) return; synchronized (mMethodMap) { final InputMethodInfo imi = mMethodMap.get(imiId); - if (imi == null) return false; + if (imi == null) return; final PackageManager pm = mContext.getPackageManager(); final String[] packageInfos = pm.getPackagesForUid(Binder.getCallingUid()); if (packageInfos != null) { @@ -1688,12 +1688,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } finally { Binder.restoreCallingIdentity(ident); } - return true; + return; } } } } - return false; + return; } private void setInputMethodWithSubtypeId(IBinder token, String id, int subtypeId) { @@ -1903,6 +1903,20 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return subtypes; } + + private static ArrayList<InputMethodSubtype> getOverridingImplicitlyEnabledSubtypes( + InputMethodInfo imi, String mode) { + ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>(); + final int subtypeCount = imi.getSubtypeCount(); + for (int i = 0; i < subtypeCount; ++i) { + final InputMethodSubtype subtype = imi.getSubtypeAt(i); + if (subtype.overridesImplicitlyEnabledSubtype() && subtype.getMode().equals(mode)) { + subtypes.add(subtype); + } + } + return subtypes; + } + private boolean chooseNewDefaultIMELocked() { List<InputMethodInfo> enabled = mSettings.getEnabledInputMethodListLocked(); if (enabled != null && enabled.size() > 0) { @@ -2357,8 +2371,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return NOT_A_SUBTYPE_ID; } - private static ArrayList<InputMethodSubtype> getApplicableSubtypesLocked( - Resources res, List<InputMethodSubtype> subtypes) { + private static ArrayList<InputMethodSubtype> getImplicitlyApplicableSubtypesLocked( + Resources res, InputMethodInfo imi) { + final List<InputMethodSubtype> subtypes = getSubtypes(imi); final String systemLocale = res.getConfiguration().locale.toString(); if (TextUtils.isEmpty(systemLocale)) return new ArrayList<InputMethodSubtype>(); HashMap<String, InputMethodSubtype> applicableModeAndSubtypesMap = @@ -2366,6 +2381,19 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final int N = subtypes.size(); boolean containsKeyboardSubtype = false; for (int i = 0; i < N; ++i) { + // scan overriding implicitly enabled subtypes. + InputMethodSubtype subtype = subtypes.get(i); + if (subtype.overridesImplicitlyEnabledSubtype()) { + final String mode = subtype.getMode(); + if (!applicableModeAndSubtypesMap.containsKey(mode)) { + applicableModeAndSubtypesMap.put(mode, subtype); + } + } + } + if (applicableModeAndSubtypesMap.size() > 0) { + return new ArrayList<InputMethodSubtype>(applicableModeAndSubtypesMap.values()); + } + for (int i = 0; i < N; ++i) { InputMethodSubtype subtype = subtypes.get(i); final String locale = subtype.getLocale(); final String mode = subtype.getMode(); @@ -2489,16 +2517,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub subtype = findLastResortApplicableSubtypeLocked( mRes, enabledSubtypes, mode, null, true); } + final ArrayList<InputMethodSubtype> overridingImplicitlyEnabledSubtypes = + getOverridingImplicitlyEnabledSubtypes(imi, mode); + final ArrayList<InputMethodSubtype> subtypesForSearch = + overridingImplicitlyEnabledSubtypes.isEmpty() + ? getSubtypes(imi) : overridingImplicitlyEnabledSubtypes; // 4. Search by the current subtype's locale from all subtypes. if (subtype == null && mCurrentSubtype != null) { subtype = findLastResortApplicableSubtypeLocked( - mRes, getSubtypes(imi), mode, mCurrentSubtype.getLocale(), false); + mRes, subtypesForSearch, mode, mCurrentSubtype.getLocale(), false); } // 5. Search by the system locale from all subtypes. // 6. Search the first enabled subtype matched with mode from all subtypes. if (subtype == null) { subtype = findLastResortApplicableSubtypeLocked( - mRes, getSubtypes(imi), mode, null, true); + mRes, subtypesForSearch, mode, null, true); } if (subtype != null) { if (imiId.equals(mCurMethodId)) { @@ -2945,12 +2978,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (explicitlyEnabledSubtypes.size() == 0) { // If there are no explicitly enabled subtypes, applicable subtypes are // enabled implicitly. - InputMethodInfo ime = mMethodMap.get(imeId); + InputMethodInfo imi = mMethodMap.get(imeId); // If IME is enabled and no subtypes are enabled, applicable subtypes // are enabled implicitly, so needs to treat them to be enabled. - if (ime != null && ime.getSubtypeCount() > 0) { + if (imi != null && imi.getSubtypeCount() > 0) { List<InputMethodSubtype> implicitlySelectedSubtypes = - getApplicableSubtypesLocked(mRes, getSubtypes(ime)); + getImplicitlyApplicableSubtypesLocked(mRes, imi); if (implicitlySelectedSubtypes != null) { final int N = implicitlySelectedSubtypes.size(); for (int i = 0; i < N; ++i) { diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java index 85d8cece..1497511 100644 --- a/services/java/com/android/server/NetworkManagementService.java +++ b/services/java/com/android/server/NetworkManagementService.java @@ -1033,6 +1033,38 @@ public class NetworkManagementService extends INetworkManagementService.Stub final NetworkStats stats = new NetworkStats(SystemClock.elapsedRealtime(), 6); final NetworkStats.Entry entry = new NetworkStats.Entry(); + final HashSet<String> knownIfaces = Sets.newHashSet(); + final HashSet<String> activeIfaces = Sets.newHashSet(); + + // collect any historical stats and active state + // TODO: migrate to reading from single file + if (mBandwidthControlEnabled) { + for (String iface : fileListWithoutNull(mStatsXtIface)) { + final File ifacePath = new File(mStatsXtIface, iface); + + final long active = readSingleLongFromFile(new File(ifacePath, "active")); + if (active == 1) { + knownIfaces.add(iface); + activeIfaces.add(iface); + } else if (active == 0) { + knownIfaces.add(iface); + } else { + continue; + } + + entry.iface = iface; + entry.uid = UID_ALL; + entry.set = SET_DEFAULT; + entry.tag = TAG_NONE; + entry.rxBytes = readSingleLongFromFile(new File(ifacePath, "rx_bytes")); + entry.rxPackets = readSingleLongFromFile(new File(ifacePath, "rx_packets")); + entry.txBytes = readSingleLongFromFile(new File(ifacePath, "tx_bytes")); + entry.txPackets = readSingleLongFromFile(new File(ifacePath, "tx_packets")); + + stats.addValues(entry); + } + } + final ArrayList<String> values = Lists.newArrayList(); BufferedReader reader = null; @@ -1058,7 +1090,13 @@ public class NetworkManagementService extends INetworkManagementService.Stub entry.txBytes = Long.parseLong(values.get(9)); entry.txPackets = Long.parseLong(values.get(10)); - stats.addValues(entry); + if (activeIfaces.contains(entry.iface)) { + // combine stats when iface is active + stats.combineValues(entry); + } else if (!knownIfaces.contains(entry.iface)) { + // add stats when iface is unknown + stats.addValues(entry); + } } catch (NumberFormatException e) { Slog.w(TAG, "problem parsing stats row '" + line + "': " + e); } @@ -1073,24 +1111,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub IoUtils.closeQuietly(reader); } - // splice in historical stats not reflected in mStatsIface - if (mBandwidthControlEnabled) { - for (String iface : fileListWithoutNull(mStatsXtIface)) { - final File ifacePath = new File(mStatsXtIface, iface); - - entry.iface = iface; - entry.uid = UID_ALL; - entry.set = SET_DEFAULT; - entry.tag = TAG_NONE; - entry.rxBytes = readSingleLongFromFile(new File(ifacePath, "rx_bytes")); - entry.rxPackets = readSingleLongFromFile(new File(ifacePath, "rx_packets")); - entry.txBytes = readSingleLongFromFile(new File(ifacePath, "tx_bytes")); - entry.txPackets = readSingleLongFromFile(new File(ifacePath, "tx_packets")); - - stats.combineValues(entry); - } - } - return stats; } diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index cbd986f..bbc26d6 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -853,6 +853,14 @@ public class PowerManagerService extends IPowerManager.Stub if ((wl.flags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0) { int oldWakeLockState = mWakeLockState; mWakeLockState = mLocks.reactivateScreenLocksLocked(); + + // Disable proximity sensor if if user presses power key while we are in the + // "waiting for proximity sensor to go negative" state. + if ((mWakeLockState & SCREEN_ON_BIT) != 0 + && mProximitySensorActive && mProximityWakeLockCount == 0) { + mProximitySensorActive = false; + } + if (mSpew) { Slog.d(TAG, "wakeup here mUserState=0x" + Integer.toHexString(mUserState) + " mWakeLockState=0x" diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index d0e8b5e..2714fc5 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -350,7 +350,6 @@ class ServerThread extends Thread { Slog.i(TAG, "Wi-Fi Service"); wifi = new WifiService(context); ServiceManager.addService(Context.WIFI_SERVICE, wifi); - wifi.checkAndStartWifi(); } catch (Throwable e) { reportWtf("starting Wi-Fi Service", e); } @@ -361,6 +360,7 @@ class ServerThread extends Thread { ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity); networkStats.bindConnectivityManager(connectivity); networkPolicy.bindConnectivityManager(connectivity); + wifi.checkAndStartWifi(); wifiP2p.connectivityServiceReady(); } catch (Throwable e) { reportWtf("starting Connectivity Service", e); diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java index e0dc96f..4d54fd4 100644 --- a/services/java/com/android/server/net/NetworkStatsService.java +++ b/services/java/com/android/server/net/NetworkStatsService.java @@ -31,6 +31,8 @@ import static android.net.NetworkStats.SET_DEFAULT; import static android.net.NetworkStats.SET_FOREGROUND; import static android.net.NetworkStats.TAG_NONE; import static android.net.NetworkStats.UID_ALL; +import static android.net.NetworkTemplate.buildTemplateMobileAll; +import static android.net.NetworkTemplate.buildTemplateWifi; import static android.net.TrafficStats.UID_REMOVED; import static android.provider.Settings.Secure.NETSTATS_NETWORK_BUCKET_DURATION; import static android.provider.Settings.Secure.NETSTATS_NETWORK_MAX_HISTORY; @@ -76,6 +78,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.provider.Settings; import android.telephony.TelephonyManager; +import android.util.EventLog; import android.util.NtpTrustedTime; import android.util.Slog; import android.util.SparseIntArray; @@ -83,6 +86,7 @@ import android.util.TrustedTime; import com.android.internal.os.AtomicFile; import com.android.internal.util.Objects; +import com.android.server.EventLogTags; import com.google.android.collect.Lists; import com.google.android.collect.Maps; import com.google.android.collect.Sets; @@ -387,7 +391,9 @@ public class NetworkStatsService extends INetworkStatsService.Stub { entry.uid = UID_ALL; entry.tag = TAG_NONE; entry.rxBytes = historyEntry.rxBytes; + entry.rxPackets = historyEntry.rxPackets; entry.txBytes = historyEntry.txBytes; + entry.txPackets = historyEntry.txPackets; stats.combineValues(entry); } @@ -716,6 +722,11 @@ public class NetworkStatsService extends INetworkStatsService.Stub { Slog.v(TAG, "performPollLocked() took " + duration + "ms"); } + // sample stats after detailed poll + if (detailedPoll) { + performSample(); + } + // finally, dispatch updated event to any listeners final Intent updatedIntent = new Intent(ACTION_NETWORK_STATS_UPDATED); updatedIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); @@ -809,6 +820,33 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } /** + * Sample recent statistics summary into {@link EventLog}. + */ + private void performSample() { + // take sample as total over last 4 hours + final long end = mTime.hasCache() ? mTime.currentTimeMillis() : System.currentTimeMillis(); + final long start = end - (4 * HOUR_IN_MILLIS); + + NetworkTemplate template = null; + NetworkStats.Entry ifaceTotal = null; + NetworkStats.Entry uidTotal = null; + + // collect mobile sample + template = buildTemplateMobileAll(getActiveSubscriberId(mContext)); + ifaceTotal = getSummaryForNetwork(template, start, end).getTotal(ifaceTotal); + uidTotal = getSummaryForAllUid(template, start, end, false).getTotal(uidTotal); + EventLogTags.writeNetstatsMobileSample( + ifaceTotal.rxBytes, ifaceTotal.txBytes, uidTotal.rxBytes, uidTotal.txBytes); + + // collect wifi sample + template = buildTemplateWifi(); + ifaceTotal = getSummaryForNetwork(template, start, end).getTotal(ifaceTotal); + uidTotal = getSummaryForAllUid(template, start, end, false).getTotal(uidTotal); + EventLogTags.writeNetstatsWifiSample( + ifaceTotal.rxBytes, ifaceTotal.txBytes, uidTotal.rxBytes, uidTotal.txBytes); + } + + /** * Clean up {@link #mUidStats} after UID is removed. */ private void removeUidLocked(int uid) { @@ -1249,6 +1287,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } }; + private static String getActiveSubscriberId(Context context) { + final TelephonyManager telephony = (TelephonyManager) context.getSystemService( + Context.TELEPHONY_SERVICE); + return telephony.getSubscriberId(); + } + /** * Key uniquely identifying a {@link NetworkStatsHistory} for a UID. */ diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index b8797d1..bfb244b 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -78,8 +78,6 @@ import android.os.Bundle; import android.os.Environment; import android.os.FileObserver; import android.os.FileUtils; -import android.os.FileUtils.FileStatus; -import android.os.Debug; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; @@ -706,6 +704,7 @@ public class PackageManagerService extends IPackageManager.Stub { Runtime.getRuntime().gc(); } if (msg.obj != null) { + @SuppressWarnings("unchecked") Set<SdInstallArgs> args = (Set<SdInstallArgs>) msg.obj; if (DEBUG_SD_INSTALL) Log.i(TAG, "Unloading all containers"); // Unload containers @@ -3039,10 +3038,6 @@ public class PackageManagerService extends IPackageManager.Stub { return null; } mScanningPath = scanFile; - if (pkg == null) { - mLastScanError = PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME; - return null; - } if ((parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) { pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index f5a5e2e..755a268 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -2498,6 +2498,10 @@ public class WindowManagerService extends IWindowManager.Stub int attrChanges = 0; int flagChanges = 0; if (attrs != null) { + if (win.mAttrs.type != attrs.type) { + throw new IllegalArgumentException( + "Window type can not be changed after the window is added."); + } flagChanges = win.mAttrs.flags ^= attrs.flags; attrChanges = win.mAttrs.copyFrom(attrs); } @@ -4703,6 +4707,8 @@ public class WindowManagerService extends IWindowManager.Stub mH.sendMessageDelayed(msg, 30*1000); } + mPolicy.systemBooted(); + performEnableScreen(); } @@ -7921,13 +7927,13 @@ public class WindowManagerService extends IWindowManager.Stub if (mWindowDetachedWallpaper != windowDetachedWallpaper) { if (DEBUG_WALLPAPER) Slog.v(TAG, "Detached wallpaper changed from " + mWindowDetachedWallpaper - + windowDetachedWallpaper); + + " to " + windowDetachedWallpaper); mWindowDetachedWallpaper = windowDetachedWallpaper; wallpaperMayChange = true; } if (windowAnimationBackgroundColor != 0) { - // If this window that wants black is the current wallpaper + // If the window that wants black is the current wallpaper // target, then the black goes *below* the wallpaper so we // don't cause the wallpaper to suddenly disappear. WindowState target = windowAnimationBackground; |
