summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/BackupManagerService.java19
-rw-r--r--services/java/com/android/server/DockObserver.java52
-rw-r--r--services/java/com/android/server/FallbackCheckinService.java48
-rw-r--r--services/java/com/android/server/InputDevice.java4
-rw-r--r--services/java/com/android/server/SystemServer.java13
-rw-r--r--services/java/com/android/server/WindowManagerService.java74
-rw-r--r--services/java/com/android/server/status/StatusBarPolicy.java22
7 files changed, 110 insertions, 122 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 27055ed..a7a6df5 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -896,9 +896,7 @@ class BackupManagerService extends IBackupManager.Stub {
try {
ApplicationInfo app = pkg.applicationInfo;
if (((app.flags&ApplicationInfo.FLAG_ALLOW_BACKUP) == 0)
- || app.backupAgentName == null
- || (mPackageManager.checkPermission(android.Manifest.permission.BACKUP_DATA,
- pkg.packageName) != PackageManager.PERMISSION_GRANTED)) {
+ || app.backupAgentName == null) {
packages.remove(a);
}
else {
@@ -1282,15 +1280,6 @@ class BackupManagerService extends IBackupManager.Stub {
for (BackupRequest request : mQueue) {
Log.d(TAG, "starting agent for backup of " + request);
- // Don't run backup, even if requested, if the target app does not have
- // the requisite permission
- if (mPackageManager.checkPermission(android.Manifest.permission.BACKUP_DATA,
- request.appInfo.packageName) != PackageManager.PERMISSION_GRANTED) {
- Log.w(TAG, "Skipping backup of unprivileged package "
- + request.appInfo.packageName);
- continue;
- }
-
IBackupAgent agent = null;
int mode = (request.fullBackup)
? IApplicationThread.BACKUP_MODE_FULL
@@ -1760,12 +1749,6 @@ class BackupManagerService extends IBackupManager.Stub {
if (DEBUG) Log.d(TAG, "processOneRestore packageName=" + packageName);
- // Don't restore to unprivileged packages
- if (mPackageManager.checkPermission(android.Manifest.permission.BACKUP_DATA,
- packageName) != PackageManager.PERMISSION_GRANTED) {
- Log.d(TAG, "Skipping restore of unprivileged package " + packageName);
- }
-
// !!! TODO: get the dirs from the transport
File backupDataName = new File(mDataDir, packageName + ".restore");
File newStateName = new File(mStateDir, packageName + ".new");
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index c907368..d280475 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -26,10 +26,14 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Binder;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
+import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
@@ -60,8 +64,11 @@ class DockObserver extends UEventObserver {
public static final int MODE_NIGHT_YES = Configuration.UI_MODE_NIGHT_YES >> 4;
private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
+ private int mPreviousDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
+
private int mNightMode = MODE_NIGHT_NO;
private boolean mCarModeEnabled = false;
+
private boolean mSystemReady;
private final Context mContext;
@@ -129,7 +136,7 @@ class DockObserver extends UEventObserver {
try {
int newState = Integer.parseInt(event.get("SWITCH_STATE"));
if (newState != mDockState) {
- int oldState = mDockState;
+ mPreviousDockState = mDockState;
mDockState = newState;
boolean carModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR;
if (mCarModeEnabled != carModeEnabled) {
@@ -143,8 +150,8 @@ class DockObserver extends UEventObserver {
// Don't force screen on when undocking from the desk dock.
// The change in power state will do this anyway.
// FIXME - we should be configurable.
- if (oldState != Intent.EXTRA_DOCK_STATE_DESK ||
- newState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
+ if (mPreviousDockState != Intent.EXTRA_DOCK_STATE_DESK ||
+ mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
mPowerManager.userActivityWithForce(SystemClock.uptimeMillis(),
false, true);
}
@@ -163,7 +170,7 @@ class DockObserver extends UEventObserver {
try {
FileReader file = new FileReader(DOCK_STATE_PATH);
int len = file.read(buffer, 0, 1024);
- mDockState = Integer.valueOf((new String(buffer, 0, len)).trim());
+ mPreviousDockState = mDockState = Integer.valueOf((new String(buffer, 0, len)).trim());
} catch (FileNotFoundException e) {
Log.w(TAG, "This kernel does not have dock station support");
@@ -195,7 +202,10 @@ class DockObserver extends UEventObserver {
public void handleMessage(Message msg) {
synchronized (this) {
Log.i(TAG, "Dock state changed: " + mDockState);
- if (Settings.Secure.getInt(mContext.getContentResolver(),
+
+ final ContentResolver cr = mContext.getContentResolver();
+
+ if (Settings.Secure.getInt(cr,
Settings.Secure.DEVICE_PROVISIONED, 0) == 0) {
Log.i(TAG, "Device not provisioned, skipping dock broadcast");
return;
@@ -217,6 +227,38 @@ class DockObserver extends UEventObserver {
intent.putExtra(BluetoothDevice.EXTRA_DEVICE,
BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address));
+ // User feedback to confirm dock connection. Particularly
+ // useful for flaky contact pins...
+ if (Settings.System.getInt(cr,
+ Settings.System.DOCK_SOUNDS_ENABLED, 1) == 1)
+ {
+ String whichSound = null;
+ if (mDockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
+ if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_DESK) {
+ whichSound = Settings.System.DESK_UNDOCK_SOUND;
+ } else if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_CAR) {
+ whichSound = Settings.System.CAR_UNDOCK_SOUND;
+ }
+ } else {
+ if (mDockState == Intent.EXTRA_DOCK_STATE_DESK) {
+ whichSound = Settings.System.DESK_DOCK_SOUND;
+ } else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR) {
+ whichSound = Settings.System.CAR_DOCK_SOUND;
+ }
+ }
+
+ if (whichSound != null) {
+ final String soundPath = Settings.System.getString(cr, whichSound);
+ if (soundPath != null) {
+ final Uri soundUri = Uri.parse("file://" + soundPath);
+ if (soundUri != null) {
+ final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
+ if (sfx != null) sfx.play();
+ }
+ }
+ }
+ }
+
// Send the ordered broadcast; the result receiver will receive after all
// broadcasts have been sent. If any broadcast receiver changes the result
// code from the initial value of RESULT_OK, then the result receiver will
diff --git a/services/java/com/android/server/FallbackCheckinService.java b/services/java/com/android/server/FallbackCheckinService.java
deleted file mode 100644
index 195eb63..0000000
--- a/services/java/com/android/server/FallbackCheckinService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.os.Binder;
-import android.os.ICheckinService;
-import android.os.IParentalControlCallback;
-import android.os.RecoverySystem;
-import android.util.Log;
-
-import java.io.IOException;
-
-import com.google.android.net.ParentalControlState;
-
-/**
- * @hide
- */
-public final class FallbackCheckinService extends ICheckinService.Stub {
- static final String TAG = "FallbackCheckinService";
- final Context mContext;
-
- public FallbackCheckinService(Context context) {
- mContext = context;
- }
-
- public void getParentalControlState(IParentalControlCallback p, String requestingApp)
- throws android.os.RemoteException {
- ParentalControlState state = new ParentalControlState();
- state.isEnabled = false;
- p.onResult(state);
- }
-}
diff --git a/services/java/com/android/server/InputDevice.java b/services/java/com/android/server/InputDevice.java
index 6f207e0..d3bb6dc 100644
--- a/services/java/com/android/server/InputDevice.java
+++ b/services/java/com/android/server/InputDevice.java
@@ -570,14 +570,14 @@ public class InputDevice {
mDownTime = curTime;
} else {
action = MotionEvent.ACTION_POINTER_DOWN
- | (upOrDownPointer << MotionEvent.ACTION_POINTER_ID_SHIFT);
+ | (upOrDownPointer << MotionEvent.ACTION_POINTER_INDEX_SHIFT);
}
} else {
if (numPointers == 1) {
action = MotionEvent.ACTION_UP;
} else {
action = MotionEvent.ACTION_POINTER_UP
- | (upOrDownPointer << MotionEvent.ACTION_POINTER_ID_SHIFT);
+ | (upOrDownPointer << MotionEvent.ACTION_POINTER_INDEX_SHIFT);
}
}
currentMove = null;
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 6e9c21b..28b4b28 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -329,19 +329,6 @@ class ServerThread extends Thread {
}
try {
- Log.i(TAG, "Checkin Service");
- Intent intent = new Intent().setComponent(new ComponentName(
- "com.google.android.server.checkin",
- "com.google.android.server.checkin.CheckinService"));
- if (context.startService(intent) == null) {
- Log.w(TAG, "Using fallback Checkin Service.");
- ServiceManager.addService("checkin", new FallbackCheckinService(context));
- }
- } catch (Throwable e) {
- Log.e(TAG, "Failure starting Checkin Service", e);
- }
-
- try {
Log.i(TAG, "Wallpaper Service");
wallpaper = new WallpaperManagerService(context);
ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 73223ee..7fcf900 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -1773,6 +1773,32 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
+ void dispatchPointerElsewhereLocked(WindowState srcWin, WindowState relWin,
+ MotionEvent pointer, long eventTime, boolean skipped) {
+ if (relWin != null) {
+ mPolicy.dispatchedPointerEventLw(pointer, relWin.mFrame.left, relWin.mFrame.top);
+ } else {
+ mPolicy.dispatchedPointerEventLw(pointer, 0, 0);
+ }
+
+ // If we sent an initial down to the wallpaper, then continue
+ // sending events until the final up.
+ if (mSendingPointersToWallpaper) {
+ if (skipped) {
+ Log.i(TAG, "Sending skipped pointer to wallpaper!");
+ }
+ sendPointerToWallpaperLocked(relWin, pointer, eventTime);
+
+ // If we are on top of the wallpaper, then the wallpaper also
+ // gets to see this movement.
+ } else if (srcWin != null
+ && pointer.getAction() == MotionEvent.ACTION_DOWN
+ && mWallpaperTarget == srcWin
+ && srcWin.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD) {
+ sendPointerToWallpaperLocked(relWin, pointer, eventTime);
+ }
+ }
+
public int addWindow(Session session, IWindow client,
WindowManager.LayoutParams attrs, int viewVisibility,
Rect outContentInsets) {
@@ -4918,10 +4944,7 @@ public class WindowManagerService extends IWindowManager.Stub
Log.w(TAG, "No window to dispatch pointer action " + ev.getAction());
}
synchronized (mWindowMap) {
- if (mSendingPointersToWallpaper) {
- Log.i(TAG, "Sending skipped pointer to wallpaper!");
- sendPointerToWallpaperLocked(null, ev, ev.getEventTime());
- }
+ dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), true);
}
if (qev != null) {
mQueue.recycleEvent(qev);
@@ -4931,10 +4954,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (targetObj == mKeyWaiter.CONSUMED_EVENT_TOKEN) {
synchronized (mWindowMap) {
- if (mSendingPointersToWallpaper) {
- Log.i(TAG, "Sending skipped pointer to wallpaper!");
- sendPointerToWallpaperLocked(null, ev, ev.getEventTime());
- }
+ dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), true);
}
if (qev != null) {
mQueue.recycleEvent(qev);
@@ -5059,9 +5079,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (!target.isVisibleLw()) {
// During this motion dispatch, the target window has become
// invisible.
- if (mSendingPointersToWallpaper) {
- sendPointerToWallpaperLocked(null, ev, eventTime);
- }
+ dispatchPointerElsewhereLocked(null, null, ev, ev.getEventTime(), false);
if (qev != null) {
mQueue.recycleEvent(qev);
}
@@ -5094,13 +5112,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- // If we are on top of the wallpaper, then the wallpaper also
- // gets to see this movement.
- if ((mWallpaperTarget == target &&
- target.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD)
- || mSendingPointersToWallpaper) {
- sendPointerToWallpaperLocked(null, ev, eventTime);
- }
+ dispatchPointerElsewhereLocked(target, null, ev, ev.getEventTime(), false);
final Rect frame = target.mFrame;
ev.offsetLocation(-(float)frame.left, -(float)frame.top);
@@ -5610,7 +5622,7 @@ public class WindowManagerService extends IWindowManager.Stub
// If an app switch key has been pressed, and we have
// waited too long for the current app to finish
// processing keys, then wait no more!
- doFinishedKeyLocked(true);
+ doFinishedKeyLocked(false);
continue;
}
long switchTimeout = mTimeToSwitch - now;
@@ -6008,7 +6020,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ ((mLastWin != null) ? mLastWin.mToken.paused : "null"));
if (mLastWin != null && (!mLastWin.mToken.paused || force
|| !mEventDispatching)) {
- doFinishedKeyLocked(false);
+ doFinishedKeyLocked(true);
} else {
// Make sure to wake up anyone currently waiting to
// dispatch a key, so they can re-evaluate their
@@ -6031,11 +6043,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (res != null && returnWhat == RETURN_PENDING_POINTER) {
synchronized (mWindowMap) {
- if ((mWallpaperTarget == win &&
- win.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD)
- || mSendingPointersToWallpaper) {
- sendPointerToWallpaperLocked(win, res, res.getEventTime());
- }
+ dispatchPointerElsewhereLocked(win, win, res, res.getEventTime(), false);
}
}
@@ -6086,13 +6094,9 @@ public class WindowManagerService extends IWindowManager.Stub
// The new window is above the old; finish pending input to the last
// window and start directing it to the new one.
mLastWin.mToken.paused = false;
- doFinishedKeyLocked(true); // does a notifyAll()
+ doFinishedKeyLocked(false); // does a notifyAll()
+ return;
}
- // Either the new window is lower, so there is no need to wake key waiters,
- // or we just finished key input to the previous window, which implicitly
- // notified the key waiters. In both cases, we don't need to issue the
- // notification here.
- return;
}
// Now that we've put a new window state in place, make the event waiter
@@ -6134,7 +6138,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ token.paused);
token.paused = false;
if (mLastWin != null && mLastWin.mToken == token && mFinished) {
- doFinishedKeyLocked(true);
+ doFinishedKeyLocked(false);
} else {
notifyAll();
}
@@ -6162,14 +6166,14 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- private final void doFinishedKeyLocked(boolean doRecycle) {
+ private final void doFinishedKeyLocked(boolean force) {
if (mLastWin != null) {
releasePendingPointerLocked(mLastWin.mSession);
releasePendingTrackballLocked(mLastWin.mSession);
}
- if (mLastWin == null || !mLastWin.mToken.paused
- || !mLastWin.isVisibleLw()) {
+ if (force || mLastWin == null || !mLastWin.mToken.paused
+ || !mLastWin.isVisibleLw()) {
// If the current window has been paused, we aren't -really-
// finished... so let the waiters still wait.
mLastWin = null;
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index 20209e4..d13f9d3 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -22,6 +22,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothPbap;
import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -30,7 +31,10 @@ import android.content.res.TypedArray;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
import android.net.NetworkInfo;
+import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Binder;
import android.os.Handler;
@@ -109,6 +113,7 @@ public class StatusBarPolicy {
private int mBatteryViewSequence;
private boolean mBatteryShowLowOnEndCall = false;
private static final boolean SHOW_LOW_BATTERY_WARNING = true;
+ private static final boolean SHOW_BATTERY_WARNINGS_IN_CALL = true;
// phone
private TelephonyManager mPhone;
@@ -686,7 +691,7 @@ public class StatusBarPolicy {
+ " mBatteryShowLowOnEndCall=" + mBatteryShowLowOnEndCall);
}
- if (mPhoneState == TelephonyManager.CALL_STATE_IDLE) {
+ if (SHOW_BATTERY_WARNINGS_IN_CALL || mPhoneState == TelephonyManager.CALL_STATE_IDLE) {
showLowBatteryWarning();
} else {
mBatteryShowLowOnEndCall = true;
@@ -810,6 +815,21 @@ public class StatusBarPolicy {
d.show();
mLowBatteryDialog = d;
}
+
+ final ContentResolver cr = mContext.getContentResolver();
+ if (Settings.System.getInt(cr,
+ Settings.System.POWER_SOUNDS_ENABLED, 1) == 1)
+ {
+ final String soundPath = Settings.System.getString(cr,
+ Settings.System.LOW_BATTERY_SOUND);
+ if (soundPath != null) {
+ final Uri soundUri = Uri.parse("file://" + soundPath);
+ if (soundUri != null) {
+ final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
+ if (sfx != null) sfx.play();
+ }
+ }
+ }
}
private final void updateCallState(int state) {