Merge "Deleting print job files when we do not have to." into klp-dev
diff --git a/core/java/android/webkit/CookieSyncManager.java b/core/java/android/webkit/CookieSyncManager.java
index 13aa43f..154a290 100644
--- a/core/java/android/webkit/CookieSyncManager.java
+++ b/core/java/android/webkit/CookieSyncManager.java
@@ -89,6 +89,10 @@
if (context == null) {
throw new IllegalArgumentException("Invalid context argument");
}
+ // TODO: Remove this workaround after webview classic is no longer supported.
+ if (WebViewFactory.getProvider().getClass().getName().contains("WebViewClassic")) {
+ WebViewDatabase.getInstance(context);
+ }
setGetInstanceIsAllowed();
return getInstance();
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 84ea4c90..49c838c 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -217,7 +217,7 @@
* stream types that follow other stream behavior for volume settings
* NOTE: do not create loops in aliases!
* Some streams alias to different streams according to device category (phone or tablet) or
- * use case (in call s off call...).See updateStreamVolumeAlias() for more details
+ * use case (in call vs off call...). See updateStreamVolumeAlias() for more details.
* mStreamVolumeAlias contains the default aliases for a voice capable device (phone) and
* STREAM_VOLUME_ALIAS_NON_VOICE for a non voice capable device (tablet).*/
private final int[] STREAM_VOLUME_ALIAS = new int[] {
@@ -301,7 +301,7 @@
private int mRingerMode;
/** @see System#MODE_RINGER_STREAMS_AFFECTED */
- private int mRingerModeAffectedStreams;
+ private int mRingerModeAffectedStreams = 0;
// Streams currently muted by ringer mode
private int mRingerModeMutedStreams;
@@ -511,9 +511,11 @@
mUseFixedVolume = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_useFixedVolume);
+ // must be called before readPersistedSettings() which needs a valid mStreamVolumeAlias[]
+ // array initialized by updateStreamVolumeAlias()
+ updateStreamVolumeAlias(false /*updateVolumes*/);
readPersistedSettings();
mSettingsObserver = new SettingsObserver();
- updateStreamVolumeAlias(false /*updateVolumes*/);
createStreamStates();
readAndSetLowRamDevice();
@@ -632,10 +634,15 @@
}
if (isInCommunication()) {
dtmfStreamAlias = AudioSystem.STREAM_VOICE_CALL;
+ mRingerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_DTMF);
+ } else {
+ mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_DTMF);
}
mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias;
if (updateVolumes) {
mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias]);
+ // apply stream mute states according to new value of mRingerModeAffectedStreams
+ setRingerModeInt(getRingerMode(), false);
sendMsg(mAudioHandler,
MSG_SET_ALL_VOLUMES,
SENDMSG_QUEUE,
@@ -702,37 +709,7 @@
mHasVibrator ? AudioManager.VIBRATE_SETTING_ONLY_SILENT
: AudioManager.VIBRATE_SETTING_OFF);
- // make sure settings for ringer mode are consistent with device type: non voice capable
- // devices (tablets) include media stream in silent mode whereas phones don't.
- mRingerModeAffectedStreams = Settings.System.getIntForUser(cr,
- Settings.System.MODE_RINGER_STREAMS_AFFECTED,
- ((1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_NOTIFICATION)|
- (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED)),
- UserHandle.USER_CURRENT);
-
- // ringtone, notification and system streams are always affected by ringer mode
- mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_RING)|
- (1 << AudioSystem.STREAM_NOTIFICATION)|
- (1 << AudioSystem.STREAM_SYSTEM);
-
- if (mVoiceCapable) {
- mRingerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_MUSIC);
- } else {
- mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC);
- }
- synchronized (mCameraSoundForced) {
- if (mCameraSoundForced) {
- mRingerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);
- } else {
- mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_SYSTEM_ENFORCED);
- }
- }
-
- Settings.System.putIntForUser(cr,
- Settings.System.MODE_RINGER_STREAMS_AFFECTED,
- mRingerModeAffectedStreams,
- UserHandle.USER_CURRENT);
-
+ updateRingerModeAffectedStreams();
readDockAudioSettings(cr);
}
@@ -2553,6 +2530,50 @@
return (mRingerModeMutedStreams & (1 << streamType)) != 0;
}
+ boolean updateRingerModeAffectedStreams() {
+ int ringerModeAffectedStreams;
+ // make sure settings for ringer mode are consistent with device type: non voice capable
+ // devices (tablets) include media stream in silent mode whereas phones don't.
+ ringerModeAffectedStreams = Settings.System.getIntForUser(mContentResolver,
+ Settings.System.MODE_RINGER_STREAMS_AFFECTED,
+ ((1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_NOTIFICATION)|
+ (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED)),
+ UserHandle.USER_CURRENT);
+
+ // ringtone, notification and system streams are always affected by ringer mode
+ ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_RING)|
+ (1 << AudioSystem.STREAM_NOTIFICATION)|
+ (1 << AudioSystem.STREAM_SYSTEM);
+
+ if (mVoiceCapable) {
+ ringerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_MUSIC);
+ } else {
+ ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC);
+ }
+ synchronized (mCameraSoundForced) {
+ if (mCameraSoundForced) {
+ ringerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);
+ } else {
+ ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_SYSTEM_ENFORCED);
+ }
+ }
+ if (mStreamVolumeAlias[AudioSystem.STREAM_DTMF] == AudioSystem.STREAM_RING) {
+ ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_DTMF);
+ } else {
+ ringerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_DTMF);
+ }
+
+ if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
+ Settings.System.putIntForUser(mContentResolver,
+ Settings.System.MODE_RINGER_STREAMS_AFFECTED,
+ ringerModeAffectedStreams,
+ UserHandle.USER_CURRENT);
+ mRingerModeAffectedStreams = ringerModeAffectedStreams;
+ return true;
+ }
+ return false;
+ }
+
public boolean isStreamAffectedByMute(int streamType) {
return (mMuteAffectedStreams & (1 << streamType)) != 0;
}
@@ -2948,13 +2969,25 @@
}
public synchronized void setAllIndexes(VolumeStreamState srcStream) {
- Set set = srcStream.mIndex.entrySet();
+ int srcStreamType = srcStream.getStreamType();
+ // apply default device volume from source stream to all devices first in case
+ // some devices are present in this stream state but not in source stream state
+ int index = srcStream.getIndex(AudioSystem.DEVICE_OUT_DEFAULT);
+ index = rescaleIndex(index, srcStreamType, mStreamType);
+ Set set = mIndex.entrySet();
Iterator i = set.iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry)i.next();
+ entry.setValue(index);
+ }
+ // Now apply actual volume for devices in source stream state
+ set = srcStream.mIndex.entrySet();
+ i = set.iterator();
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry)i.next();
int device = ((Integer)entry.getKey()).intValue();
- int index = ((Integer)entry.getValue()).intValue();
- index = rescaleIndex(index, srcStream.getStreamType(), mStreamType);
+ index = ((Integer)entry.getValue()).intValue();
+ index = rescaleIndex(index, srcStreamType, mStreamType);
setIndex(index, device);
}
@@ -3643,29 +3676,11 @@
// and mRingerModeAffectedStreams, so will leave this synchronized for now.
// mRingerModeMutedStreams and mMuteAffectedStreams are safe (only accessed once).
synchronized (mSettingsLock) {
- int ringerModeAffectedStreams = Settings.System.getIntForUser(mContentResolver,
- Settings.System.MODE_RINGER_STREAMS_AFFECTED,
- ((1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_NOTIFICATION)|
- (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED)),
- UserHandle.USER_CURRENT);
- if (mVoiceCapable) {
- ringerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_MUSIC);
- } else {
- ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC);
- }
- synchronized (mCameraSoundForced) {
- if (mCameraSoundForced) {
- ringerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);
- } else {
- ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_SYSTEM_ENFORCED);
- }
- }
- if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
+ if (updateRingerModeAffectedStreams()) {
/*
* Ensure all stream types that should be affected by ringer mode
* are in the proper state.
*/
- mRingerModeAffectedStreams = ringerModeAffectedStreams;
setRingerModeInt(getRingerMode(), false);
}
readDockAudioSettings(mContentResolver);
diff --git a/packages/PrintSpooler/res/layout/select_printer_activity.xml b/packages/PrintSpooler/res/layout/select_printer_activity.xml
index e86e9aa..2792dcf 100644
--- a/packages/PrintSpooler/res/layout/select_printer_activity.xml
+++ b/packages/PrintSpooler/res/layout/select_printer_activity.xml
@@ -38,25 +38,30 @@
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
-
+
<ImageView
- android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dip"
android:src="@*android:drawable/ic_grayedout_printer"
- android:contentDescription="@string/print_no_printers_found">
+ android:contentDescription="@string/print_searching_for_printers">
</ImageView>
<TextView
- android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorSecondary"
- android:text="@string/print_no_printers_found">
+ android:text="@string/print_searching_for_printers">
</TextView>
+ <ProgressBar
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:indeterminate="true"
+ style="@android:style/Widget.Holo.ProgressBar.Horizontal">
+ </ProgressBar>
+
</LinearLayout>
</FrameLayout>
diff --git a/packages/PrintSpooler/res/values/strings.xml b/packages/PrintSpooler/res/values/strings.xml
index 41775a1..5b947ba 100644
--- a/packages/PrintSpooler/res/values/strings.xml
+++ b/packages/PrintSpooler/res/values/strings.xml
@@ -84,7 +84,7 @@
<string name="choose_print_service">Choose print service</string>
<!-- Title for the prompt shown as a placeholder if no printers are found while searching. [CHAR LIMIT=50] -->
- <string name="print_no_printers_found">No printers found</string>
+ <string name="print_searching_for_printers">Searching for printers</string>
<!-- Notifications -->
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
index 8474115..0c593ef 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
@@ -1613,7 +1613,6 @@
mCopiesEditText = (EditText) findViewById(R.id.copies_edittext);
mCopiesEditText.setText(MIN_COPIES_STRING);
mCopiesEditText.addTextChangedListener(mCopiesTextWatcher);
- mCopiesEditText.selectAll();
if (!TextUtils.equals(mCopiesEditText.getText(), MIN_COPIES_STRING)) {
mIgnoreNextCopiesChange = true;
}
@@ -1622,6 +1621,7 @@
// Destination.
mDestinationSpinner = (Spinner) findViewById(R.id.destination_spinner);
+ mDestinationSpinner.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mDestinationSpinner.setAdapter(mDestinationSpinnerAdapter);
mDestinationSpinner.setOnItemSelectedListener(mOnItemSelectedListener);
if (mDestinationSpinnerAdapter.getCount() > 0 && mController.hasStarted()) {
@@ -1954,7 +1954,6 @@
&& TextUtils.isEmpty(mCopiesEditText.getText())) {
mIgnoreNextCopiesChange = true;
mCopiesEditText.setText(String.valueOf(MIN_COPIES));
- mCopiesEditText.selectAll();
mCopiesEditText.requestFocus();
}
@@ -2151,6 +2150,8 @@
R.layout.printer_dropdown_item, parent, false);
}
+ convertView.getLayoutParams().width = mDestinationSpinner.getWidth();
+
CharSequence title = null;
CharSequence subtitle = null;
Drawable icon = null;
diff --git a/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java b/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java
index c888e2c..114c151 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java
@@ -36,6 +36,7 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
+import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.print.PrintManager;
@@ -53,6 +54,7 @@
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
+import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.TextView;
@@ -357,11 +359,12 @@
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(
- R.layout.spinner_dropdown_item, parent, false);
+ R.layout.printer_dropdown_item, parent, false);
}
CharSequence title = null;
CharSequence subtitle = null;
+ Drawable icon = null;
PrinterInfo printer = (PrinterInfo) getItem(position);
title = printer.getName();
@@ -370,6 +373,7 @@
PackageInfo packageInfo = pm.getPackageInfo(printer.getId()
.getServiceName().getPackageName(), 0);
subtitle = packageInfo.applicationInfo.loadLabel(pm);
+ icon = packageInfo.applicationInfo.loadIcon(pm);
} catch (NameNotFoundException nnfe) {
/* ignore */
}
@@ -386,6 +390,15 @@
subtitleView.setVisibility(View.GONE);
}
+
+ ImageView iconView = (ImageView) convertView.findViewById(R.id.icon);
+ if (icon != null) {
+ iconView.setImageDrawable(icon);
+ iconView.setVisibility(View.VISIBLE);
+ } else {
+ iconView.setVisibility(View.GONE);
+ }
+
return convertView;
}
diff --git a/services/java/com/android/server/am/ProcessStatsService.java b/services/java/com/android/server/am/ProcessStatsService.java
index 7dc006c..dbc05fa 100644
--- a/services/java/com/android/server/am/ProcessStatsService.java
+++ b/services/java/com/android/server/am/ProcessStatsService.java
@@ -97,6 +97,19 @@
});
}
+ @Override
+ public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
+ throws RemoteException {
+ try {
+ return super.onTransact(code, data, reply, flags);
+ } catch (RuntimeException e) {
+ if (!(e instanceof SecurityException)) {
+ Slog.wtf(TAG, "Process Stats Crash", e);
+ }
+ throw e;
+ }
+ }
+
public ProcessStats.ProcessState getProcessStateLocked(String packageName,
int uid, String processName) {
return mProcessStats.getProcessStateLocked(packageName, uid, processName);
@@ -477,7 +490,7 @@
- moreStats.mTimePeriodStartRealtime, sb);
Slog.i(TAG, sb.toString());
} else {
- Slog.w(TAG, "Failure reading " + files.get(i) + "; "
+ Slog.w(TAG, "Failure reading " + files.get(i-1) + "; "
+ moreStats.mReadError);
continue;
}