128 Commits

Author SHA1 Message Date
Jeff Sharkey
350083e36b Migrate bandwidth control to NMS, omit history.
Both stats and policy make NMS calls that depend on bandwidth control
being enabled, so move enable/disable into NMS and drop calls when
disabled.  This avoids throwing heavy ISE exceptions when disabled.

Only include recent data when writing NetworkStatsHistory as part of
dumpsys call.  Introduce manual poll event for Settings UI.

Bug: 4982115, 4770435, 4515856
Change-Id: I257820b057af2f0f99c736fb4f61e55b9fdc3e66
2011-06-30 15:47:51 -07:00
Ashish Sharma
50fd36d7c3 Push interface quota rules from NetworkPolicyManager to kernel.
Change-Id: Id2b758f561820b44839f69bf5fbd676cae771fe3
2011-06-29 10:51:06 -07:00
Jake Hamby
aa6bd940f0 Don't enable Bluetooth when booting into airplane mode.
When airplane mode is enabled and the phone is rebooted, Bluetooth
should not turn on. Previously the airplane mode setting was ignored
and only the Bluetooth enabled setting was used to determine whether
to enable Bluetooth at boot time. Now, both settings are checked.

Bug: 3404790
Change-Id: I5e3095a94e50825dd469addebef97a7c85041fca
2011-06-27 16:32:37 -07:00
satok
8969d9924c Revert "Create TextServiceManager and SpellCheckerService"
This reverts commit eaddb894865a804279659b4aad6364a34ab50beb.
2011-06-22 16:41:58 +09:00
satok
eaddb89486 Create TextServiceManager and SpellCheckerService
Bug: 4176026

Spec of TextServiceManager
- Chooses the most applicable TextService(e.g. SpellCheckerService, WordBreakIteratorService..)
    for each locale

Spec of SpellCheckerService
- Returns whether the given string is a correct word or not
- Returns Suggestions for the given string

Change-Id: Ia25e7b4f308778891929e31b8cbd741f6848cce4
2011-06-20 23:00:30 +09:00
Mike Lockwood
02e4569b5f USB: Support for new USB gadget drivers
Change-Id: Id08df50acb873a94f4765a991ee6a6f5b898ddf5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17 19:49:05 -04:00
Jeff Sharkey
497e4437af Data usage warning and limit notifications.
Watch for network statistics to cross NetworkPolicy warning or limit,
and show notifications to user as needed.  Currently checks during
any statistics update, but will eventually move to event registration
through netd when kernel supports.

Fixed accounting bug in getSummaryForNetwork().  Only apply UID policy
to applications; applying to system processes could break critical
services like RIL.

Change-Id: Iac0f20e910e205f3cbc54ec96395ff268b1aa379
2011-06-14 22:43:08 -07:00
Mike Lockwood
541c9949ae Move adb related functionality from SystemServer and NotificationManagerService to UsbDeviceManager
Change-Id: I9e64b54bc2d027d88ae2d2cd893068e29b6fe237
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-13 22:20:06 -04:00
Jeff Sharkey
21c9c45e5c Interface-level network policy, persist policies.
Define NetworkPolicy as cycle-reset day and warning/limit values, and
set/get through NetworkPolicyManager.  Watch ConnectivityManager for
network connection events, and apply quota rules based on matching
interfaces.  Policy service matches based on strong identity to support
IMSI-specific policy values.

Calculates remaining quota based on current stats recorded since the
last reset cycle day.  Tests to verify edge cases around February.

Persist network and UID policies in XML, and restore on boot.

Change-Id: Id40ba7d6eed6094fbd5e18e6331286c606880d80
2011-06-10 19:35:20 -07:00
Jeff Sharkey
d2a458750e Map network identity using ConnectivityService.
Instead of deriving network identity based on raw subsystem broadcasts,
listen for updates from ConnectivityService.  Added atomic view of all
active NetworkState, and build map from "iface" to NetworkIdentity set
for stats tracking.

To avoid exposing internal complexity, INetworkStatsService calls use
general templates.  Added TelephonyManager mapping to classify network
types using broad labels like "3G" or "4G", used to drive templates.

Cleaned up Objects and Preconditions.

Change-Id: I1d4c1403f0503bc3635a59bb378841ba42239a91
2011-06-07 23:09:25 -07:00
Jeff Sharkey
7527990420 Collect historical network stats.
Periodically records delta network traffic into historical buckets to
support other services, such NetworkPolicyManager and Settings UI.

Introduces NetworkStatsHistory structure which contains sparse, uniform
buckets of data usage defined by timestamps.  Service periodically
polls NetworkStats and records changes into buckets.  It only persists
to disk when substantial changes have occured.  Current parameters
create 4 buckets each day, and persist for 90 days, resulting in about
8kB of data per network.

Only records stats for "well known" network interfaces that have been
claimed by Telephony or Wi-Fi subsystems.  Historical stats are also
keyed off identity (such as IMSI) to support SIM swapping.

Change-Id: Ia27d1289556a2bf9545fbc4f3b789425a01be53a
2011-06-01 17:44:52 -07:00
Jeff Sharkey
c006f1aec1 Policy and rules work for ConnectivityManager.
Teach ConnectivityManager about UID-specific rules derived from policy,
such as rejecting network traffic on "paid" interfaces.  Calls that
return NetworkInfo now filter based on any REJECT rules in effect for
the calling UID.  (Added uid parameter if callers that still want all
interfaces.)

Changed NetworkPolicyManager to derive rules based on current policy
combined with PowerManager and ActivityManager status, which it passes
to ConnectivityService for eventual enforcement through netd.  When
rules change the usability of a NetworkInfo for a specific UID, it also
dispatches CONNECTIVITY_ACTION broadcasts to that UID.  Combined paid
and background policy together to match current working definition.

Change-Id: I797ea49439fcc487cfe2cbc16703d4b91ceb9af6
2011-06-01 17:00:42 -07:00
Jeff Sharkey
a462079303 Observe screen on/off events in NetworkPolicy.
The POLICY_REJECT_BACKGROUND policy requires that network traffic be
blocked when a UID goes into the background.  Even if the UID has an
activity in the foreground, it's considered "background" if the screen
is turned off.

This changes watches for SCREEN_ON/OFF broadcasts, and rule generation
now observes screen state.  It also introduces an observer pattern so
that ActivityManager doesn't directly know about NetworkPolicy, and
moves the service management into SystemServer.

Change-Id: Ie7a84929d3ca60ae4578d47e19d5a8da10fd8d58
2011-05-23 18:39:56 -07:00
Jeff Brown
6e6cd7a566 Move accessibility manager service to own package.
Change-Id: I0d73737a21615f0ff0abc80b757fb8c9bcb50be5
2011-03-30 03:29:30 -07:00
Kenny Root
cf0b38ca6e Split PackageManagerService into subclasses
Split PackageManagerService from one monolithic class with several inner
classes to several classes. This will help determining how its data
structures can be reshuffled to provide better separation of concerns.

Change-Id: Ic7571daebdcf13ce08e08f34204c5bbf4140139b
2011-03-22 16:17:57 -07:00
Mike Lockwood
02eb8746de UsbManager: Enhancements for managing USB devices and accessories
When a USB device or accessory is connected, the UsbService now asks the
user which application to associate with the device or accessory.
Applications interested in devices or accessories must specify the
devices they work with via meta-data attached to their manifest.
Permission to communicate with the device is assigned when the user chooses
the activity to use for the device.
The user has the option of clicking the "always use this application" checkbox
to make the assignment automatic in the future.
The user may later clear this preference and revoke permission for an application
to have permission to communicate with the device by clicking the "Clear defaults"
button for the activity in the Manage Applications panel in Settings.

Added class UsbResolveActivity (a subclass or ResolveActivity for choosing
an activity for a USB device or accessory)

Added UsbDeviceManager, which manages the mapping between USB devices/accessories
and applications, including default applications for devices and accessories,
and manages application permissions.

Add interface to allow Settings to clear device and accessory
preferences and permissions for an application.

Remove obsolete ACCESS_USB permission.

Add new signatureOrSystem MANAGE_USB permission to allow administrating
preferences and permissions.

Moved UsbService.java to a "usb" subdirectory, along with new classes
UsbResolveActivity and UsbDeviceManager.

Change-Id: I92554381e9779e68ce380daaee4e1401fb875703
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-28 17:00:45 -08:00
Dianne Hackborn
a924dc0db9 Start window manager refactoring.
Move all of the pieces into a new com.android.server.wm package.

Change-Id: I942b7bcfb84ee0f843f47d58e55ffc5a93c0da94
2011-02-17 14:22:17 -08:00
Dianne Hackborn
7da70821f7 am 94baff47: am 1b1962f3: Merge "Fix issue #3420898: More wallpaper issues" into honeycomb
* commit '94baff47975fb3ae1380333f23fc2de2dc65eb86':
  Fix issue #3420898: More wallpaper issues
2011-02-07 11:39:45 -08:00
Dianne Hackborn
ac1471a4ff Fix issue #3420898: More wallpaper issues
- The ImageWallpaper wasn't watching for the desired dimensions to
  change, at which point it needs to resize its surface.
- The system process has been running with the small dalvik heap
  limit, which is too tight with these huge wallpapers; this would
  cause switching wallpapers to eventually stop working as it
  couldn't get the memory it needed to load the new one.
- The compatibility mode background surface had a bunch of issues,
  such as moving its windows to the right by the window size to
  make them disappear.  This of course doesn't play well with the
  now super-sized wallpaper surface.  This code is re-worked to
  not require such shenanigans.

Change-Id: I64fde4059645d8507f1c4761ba6c17b89877a5c0
2011-02-03 16:54:24 -08:00
Jeff Brown
46bfd4a355 resolved conflicts for merge of c608e106 to master
Change-Id: I49117966f43080d86763bab51848dbc50e55ecf8
2011-01-30 12:50:09 -08:00
Jeff Brown
2992ea782f Add "Use physical keyboard" option to system bar IME button.
Bug: 3391067
Change-Id: I136087ca4f726d0068d5983d7d3686787ba60c55
2011-01-28 22:06:36 -08:00
Mike Lockwood
e7d511e148 New APIs for USB host support:
UsbManager:
- is now a service retrievable via Context.getSystemService(Context.USB_SERVICE).
- provides support for returning a list all connected USB devices
- broadcasts ACTION_USB_DEVICE_ATTACHED and USB_DEVICE_DETACHED when devices
  are added and removed from the USB host bus

UsbDevice:
- represents an attached USB device.

UsbInterface:
- represents an interface on a USB device
- devices may have multiple interfaces if they provide multiple
   sets of functionality (for example, android phones typically have interfaces
   for both USB mass storage and adb)

UsbEndpoint:
- represents an endpoint on a USB interface
- endpoints are used for sending or receiving data
  (only in one or the other direction)

UsbRequest:
- encapsulates a send or receive request to be sent over an endpoint

Change-Id: Ieef3e434c62760770ea839070cf5eba1a705967a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-22 15:56:09 -08:00
David 'Digit' Turner
3612f0870c Merge "SystemServer: Do not register null BlueTooth service in the emulator" into honeycomb 2011-01-16 19:25:01 -08:00
David 'Digit' Turner
e2a5e86c9f SystemServer: Do not register null BlueTooth service in the emulator
Because registering a null service generates an exception. See bug 3356000

Change-Id: Id7b4af815942e498d750c1b7a412d5ee26b61ad4
2011-01-17 01:10:21 +01:00
Jeff Brown
b09abc1dd2 Add volume down as a safe mode key for Stingray.
Fixed a race condition during startup.  We need to wait for the input
devices to actually be ready before trying to detect safe mode.

Fixed a problem during safe mode activation where we would try to add
the overlay window but the display was not initialized.  Now we do it
after the system is ready.

Bug: 3134825
Change-Id: I4c043c142ae6bf0d865c79d266d36154eaf00709
2011-01-13 21:18:16 -08:00
Mike Lockwood
770126a678 Rename android.hardware.Usb to UsbManager and UsbObserver to UsbService
In preparation for an upcoming change that will make UsbService into a real system service

Change-Id: Id85d624cfc6b10b49a08105cfaaacc667a492c12
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-12-09 22:52:05 -08:00
Praveen Bharathi
21e941bf43 Added support for dock headset observer
Change-Id: I06b2e65e3bfa10735e6c7fd3349afa9ae7d45292
Signed-off-by: Praveen Bharathi <pbharathi@motorola.com>
2010-11-01 18:41:19 -07:00
Joe Onorato
de1b359e88 Move the battery LED code over to the battery service from the notification service (!)
Change-Id: I12d7994ae245a36b8b2c3272fcbe173881caebd0
2010-10-27 11:26:00 -07:00
Joe Onorato
f3c3c4fd14 Refactor SystemUI so the status bar isn't a Service of its own.
There is now one SystemUIService, which starts the status bar service.
Pretty soon there will be other things running in here too.  This way
we don't need to have each of them started by something individually.

This also moves the choice between tablet and phone status bar into
SystemUI.apk, which seems like a much better place for it.

Change-Id: Ib69ef2f43d648764f8dbb52008f5d036a1ee07d9
2010-10-21 15:42:34 -04:00
Jaikumar Ganesh
7d0548d094 Fix race condition between starting of service and getting the Profile Proxy.
Incoming A2DP connections were not working.

Change-Id: I5a3322ddb39b2512495b4cd2e35593da0f605087
2010-10-18 15:32:11 -07:00
Nick Pelly
cd0e839a24 NFC: Move NFC service implementation out of system_server.
NFC service is now an application service in packages/apps/Nfc.

NFC service is registered through ServiceManager.addService(), and the proxy
object NfcAdapter obtains a handle to it through ServiceManager.getService().

**Important** Had to add new symbols AID_NFC / NFC_UID / android.uid.nfc and
modify service_manager.c, Process.java and PackageManagerService.java in order
to force the com.android.nfc process to take a fixed uid, so that it can use
ServiceManager.addService().

Most of the JNI has moved to packages/apps/Nfc/jni. However NdefRecord and
NdefMessage require some in-process native code, so android_com_NdefMessage.cpp
and android_com_NdefRecord.cpp stay in frameworks/base/core/jni. They link to
a very small library libnfc_ndef.so that implements NDEF message parsing. This
has been added to core.mk so all devices (even without NFC hardware) can work
with NDEF data.

Bug: 3041259
Bug: 3097445
Change-Id: If7f00cd8f2053acfc9319ca366d4a9c02bd396e6
Signed-off-by: Nick Pelly <npelly@google.com>
2010-10-17 18:35:29 -07:00
Kenny Root
9456714cfb am b4f26a9d: am e6ae5c39: Merge "Add shutdown assurance" into gingerbread
Merge commit 'b4f26a9d37caf7762b66b68d50825c5b075b42bd'

* commit 'b4f26a9d37caf7762b66b68d50825c5b075b42bd':
  Add shutdown assurance
2010-10-15 00:08:22 -07:00
Kenny Root
f547d679c0 Add shutdown assurance
If something kills system_server before it completes its shutdown
action, the runtime will just restart giving the illusion that a reboot
for an OTA or something else has happened.

To prevent this, write a system property containing the reboot reason
before initiating the shutdown with all the services. If the
system_server is killed before it completes, the next time the main
thread of system_server starts up, it will immediately execute the
shutdown action.

Bug: 3022556
Change-Id: I81723bac333430f04205e7a7b799914d96f170eb
2010-10-13 11:45:35 -07:00
Brad Fitzpatrick
5e6338d4a8 am 2af4c51e: am 6bb7a4a6: Go one day into 1970 for timezone code.
Merge commit '2af4c51e9a82848e3efce4621559a69fda965665'

* commit '2af4c51e9a82848e3efce4621559a69fda965665':
  Go one day into 1970 for timezone code.
2010-10-12 13:22:27 -07:00
Brad Fitzpatrick
5fdc0c7397 resolved conflicts for merge of 14d151bf to master
Change-Id: Ib1ac9acfd6dc71b5fa4e1456a056d1e9dee65fda
2010-10-12 13:12:18 -07:00
Brad Fitzpatrick
6bb7a4a68a Go one day into 1970 for timezone code.
Change-Id: I80251de79db6684ef3fa1ec835b400d9e3547401
2010-10-11 13:43:51 -07:00
Brad Fitzpatrick
35ca9d8a35 On boot, advance time to at least 1970.
Otherwise various Java APIs start doing their documented "correct"
thing, which is to fail.

Bug: 3081605
Change-Id: I90f8cde745d2ddab78419e37f60eea1e81a58127
2010-10-11 12:17:16 -07:00
Joe Onorato
dc565f4b3a work around race condition which causes us to try to load the phone
status bar on the tablet.

Change-Id: Id5ad1192b4667622957fd0c48870ea22a480e0b5
2010-10-04 15:27:22 -04:00
Nick Pelly
4715bd91f5 resolved conflicts for merge of f4c3b7e9 to master
Change-Id: Idcdc521144f3072058b2bb6cb383e42c852e64f4
2010-09-29 12:20:51 -07:00
Nick Pelly
038cabe024 NFC integration
Source: Trusted_NFC_Device_Host_AA03.01e02_google.zip code drop (23-Sep-2010)

Conflicts:

	core/java/android/app/ApplicationContext.java
	core/java/android/provider/Settings.java
	core/jni/Android.mk
	core/jni/AndroidRuntime.cpp
	core/res/AndroidManifest.xml
	include/utils/Asset.h

Change-Id: I62c92f4c79f5ee65126c97602f6bc1c15794e573
Signed-off-by: Nick Pelly <npelly@google.com>
2010-09-28 22:36:27 -07:00
Hung-ying Tyan
400f12b4dd Fix build.
Change-Id: Iae02fabe42013705592f75748388daf8fa5ed54e
2010-09-28 13:01:49 +08:00
Hung-ying Tyan
a57afb6a6c resolved conflicts for merge of 2a36a778 to master
Change-Id: Ia70adeef06afddd29c827405fb5657bf9f5a29a3
2010-09-28 12:17:44 +08:00
Hung-ying Tyan
7e54ef71db Move SipService out of SystemServer to phone process.
Companion CL: https://android-git/g/#change,70187
http://b/issue?id=2998069

Change-Id: I90923ac522ef363a4e04292f652d413c5a1526ad
2010-09-28 05:19:35 +08:00
Robert Greenwalt
35dcaece11 am 9c38a6dc: am e87ebb08: Merge "Cleanup Netd to prevent getting hung." into gingerbread
Merge commit '9c38a6dc13ba55fccb9c66f347307a1b4ae68105'

* commit '9c38a6dc13ba55fccb9c66f347307a1b4ae68105':
  Cleanup Netd to prevent getting hung.
2010-09-23 09:40:20 -07:00
Robert Greenwalt
e5c3afb292 Cleanup Netd to prevent getting hung.
If the sending of the command fails we should note it and not wait forever
for the response.

We should also not say we're ready until we actually are.

bug:2993205
Change-Id: I380f0312ac4693ad184a526b330fdfa23f6ac558
2010-09-22 16:43:23 -07:00
Amith Yamasani
6734b9f680 Provide automatic date/time based on NTP lookup.
Do this on a periodic basis as well as when the AUTO_TIME setting changes to true.

If we recently acquired NITZ time from the telephony provider, then don't override
with NTP time.
2010-09-15 13:14:18 -07:00
Brad Fitzpatrick
b835d9abd6 am f26ac1f8: am 96d6c345: Merge "Unify some duplicate StrictMode-enabling code." into gingerbread
Merge commit 'f26ac1f8ed27d9e88bbde8978557c34788c7509c'

* commit 'f26ac1f8ed27d9e88bbde8978557c34788c7509c':
  Unify some duplicate StrictMode-enabling code.
2010-09-15 11:37:54 -07:00
Brad Fitzpatrick
50d66f9fcd Unify some duplicate StrictMode-enabling code.
Change-Id: Ifb92f35d9e245dbdb5e201597d8be702bce9e8b8
2010-09-14 08:22:30 -07:00
Brad Fitzpatrick
c74a1b4414 Fix build caused by automerger and missing imports in master.
gingerbread had an import android.os.*.  master doesn't.  auto-merger
applied it fine, but it doesn't compile.

Change-Id: I28d7b5053616a40223eeb29a0669831d5ca76d9e
2010-09-10 16:03:29 -07:00
Brad Fitzpatrick
0b29554188 am 37fc8cc7: am b724d251: Merge "Enable strictmode logging in system_server & add a lock." into gingerbread
Merge commit '37fc8cc7b87133eddacaeab60cabefaf4a7b9bdd'

* commit '37fc8cc7b87133eddacaeab60cabefaf4a7b9bdd':
  Enable strictmode logging in system_server & add a lock.
2010-09-10 15:07:20 -07:00