Merge "Finer tessellation can draw better looking shadows for circles." into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index 4dbe887..b6e600b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5453,6 +5453,7 @@
method public boolean hasCaCertInstalled(android.content.ComponentName, byte[]);
method public boolean hasGrantedPolicy(android.content.ComponentName, int);
method public boolean installCaCert(android.content.ComponentName, byte[]);
+ method public boolean installKeyPair(android.content.ComponentName, java.security.PrivateKey, java.security.cert.Certificate, java.lang.String);
method public boolean isActivePasswordSufficient();
method public boolean isAdminActive(android.content.ComponentName);
method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String);
@@ -5683,6 +5684,7 @@
method public int describeContents();
method public android.os.PersistableBundle getExtras();
method public int getJobId();
+ method public boolean isOverrideDeadlineExpired();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
@@ -16343,10 +16345,10 @@
package android.media.projection {
public final class MediaProjection {
- method public void addCallback(android.media.projection.MediaProjection.Callback, android.os.Handler);
method public android.hardware.display.VirtualDisplay createVirtualDisplay(java.lang.String, int, int, int, int, android.view.Surface, android.hardware.display.VirtualDisplay.Callback, android.os.Handler);
- method public void removeCallback(android.media.projection.MediaProjection.Callback);
+ method public void registerCallback(android.media.projection.MediaProjection.Callback, android.os.Handler);
method public void stop();
+ method public void unregisterCallback(android.media.projection.MediaProjection.Callback);
}
public static abstract class MediaProjection.Callback {
@@ -16355,8 +16357,8 @@
}
public final class MediaProjectionManager {
+ method public android.content.Intent createScreenCaptureIntent();
method public android.media.projection.MediaProjection getMediaProjection(int, android.content.Intent);
- method public android.content.Intent getScreenCaptureIntent();
}
}
@@ -28255,16 +28257,15 @@
method public final boolean isRequestingRingback();
method public void onAbort();
method public void onAnswer();
+ method public void onAudioStateChanged(android.telecomm.AudioState);
method public void onConferenceWith(android.telecomm.Connection);
method public void onDisconnect();
method public void onHold();
- method public void onPhoneAccountClicked();
method public void onPlayDtmfTone(char);
method public void onPostDialContinue(boolean);
method public void onReject();
method public void onSeparate();
- method public void onSetAudioState(android.telecomm.AudioState);
- method public void onSetState(int);
+ method public void onStateChanged(int);
method public void onStopDtmfTone();
method public void onUnhold();
method public final void setActive();
@@ -28320,9 +28321,9 @@
public class GatewayInfo implements android.os.Parcelable {
method public int describeContents();
- method public android.net.Uri getGatewayHandle();
+ method public android.net.Uri getGatewayAddress();
method public java.lang.String getGatewayProviderPackageName();
- method public android.net.Uri getOriginalHandle();
+ method public android.net.Uri getOriginalAddress();
method public boolean isEmpty();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
@@ -28340,9 +28341,12 @@
method public java.lang.CharSequence getShortDescription();
method public android.net.Uri getSubscriptionAddress();
method public java.util.List<java.lang.String> getSupportedUriSchemes();
+ method public boolean hasCapabilities(int);
+ method public boolean isEnabled();
method public boolean supportsUriScheme(java.lang.String);
method public void writeToParcel(android.os.Parcel, int);
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
+ field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
field public static final android.os.Parcelable.Creator CREATOR;
field public static final java.lang.String SCHEME_SIP = "sip";
@@ -28352,6 +28356,7 @@
public static class PhoneAccount.Builder {
ctor public PhoneAccount.Builder(android.telecomm.PhoneAccountHandle, java.lang.CharSequence);
+ ctor public PhoneAccount.Builder(android.telecomm.PhoneAccount);
method public android.telecomm.PhoneAccount build();
method public android.telecomm.PhoneAccount.Builder setAddress(android.net.Uri);
method public android.telecomm.PhoneAccount.Builder setCapabilities(int);
@@ -28383,14 +28388,6 @@
field public static final int SWAP_CONFERENCE = 8; // 0x8
}
- public class PropertyPresentation {
- ctor public PropertyPresentation();
- field public static final int ALLOWED = 1; // 0x1
- field public static final int PAYPHONE = 4; // 0x4
- field public static final int RESTRICTED = 2; // 0x2
- field public static final int UNKNOWN = 3; // 0x3
- }
-
public final class RemoteConference {
method public final void addCallback(android.telecomm.RemoteConference.Callback);
method public void disconnect();
@@ -28465,11 +28462,6 @@
method public void onStatusHintsChanged(android.telecomm.RemoteConnection, android.telecomm.StatusHints);
}
- public abstract interface Response {
- method public abstract void onError(IN, int, java.lang.String);
- method public abstract void onResult(IN, OUT...);
- }
-
public final class StatusHints implements android.os.Parcelable {
ctor public StatusHints(android.content.ComponentName, java.lang.CharSequence, int, android.os.Bundle);
method public int describeContents();
@@ -28485,7 +28477,7 @@
public class TelecommManager {
method public void addNewIncomingCall(android.telecomm.PhoneAccountHandle, android.os.Bundle);
method public void cancelMissedCallsNotification();
- method public void clearAccounts(java.lang.String);
+ method public void clearAccounts();
method public android.telecomm.PhoneAccountHandle getConnectionManager();
method public android.telecomm.PhoneAccountHandle getDefaultOutgoingPhoneAccount(java.lang.String);
method public java.util.List<android.telecomm.PhoneAccountHandle> getEnabledPhoneAccounts();
@@ -28508,6 +28500,12 @@
field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecomm.extra.CONNECTION_SERVICE";
field public static final java.lang.String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telecomm.extra.PHONE_ACCOUNT_HANDLE";
field public static final java.lang.String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.telecomm.extra.START_CALL_WITH_SPEAKERPHONE";
+ field public static final java.lang.String GATEWAY_ORIGINAL_ADDRESS = "android.telecomm.extra.GATEWAY_ORIGINAL_ADDRESS";
+ field public static final java.lang.String GATEWAY_PROVIDER_PACKAGE = "android.telecomm.extra.GATEWAY_PROVIDER_PACKAGE";
+ field public static final int PRESENTATION_ALLOWED = 1; // 0x1
+ field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
+ field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
+ field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
}
}
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 989b500..57c1505 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -855,7 +855,7 @@
}
private void sendBroadcast() throws Exception {
- Intent intent = makeIntent(UserHandle.USER_ALL);
+ Intent intent = makeIntent(UserHandle.USER_CURRENT);
IntentReceiver receiver = new IntentReceiver();
System.out.println("Broadcasting: " + intent);
mAm.broadcastIntent(null, intent, null, receiver, 0, null, null, mReceiverPermission,
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 8f1343d..4a21913 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -38,6 +38,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
+import android.security.Credentials;
import android.service.restrictions.RestrictionsReceiver;
import android.util.Log;
@@ -49,6 +50,8 @@
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
+import java.security.PrivateKey;
+import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
@@ -1838,6 +1841,32 @@
}
/**
+ * Called by a device or profile owner to install a certificate and private key pair. The
+ * keypair will be visible to all apps within the profile.
+ *
+ * @param who Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param privKey The private key to install.
+ * @param cert The certificate to install.
+ * @param alias The private key alias under which to install the certificate. If a certificate
+ * with that alias already exists, it will be overwritten.
+ * @return {@code true} if the keys were installed, {@code false} otherwise.
+ */
+ public boolean installKeyPair(ComponentName who, PrivateKey privKey, Certificate cert,
+ String alias) {
+ try {
+ final byte[] pemCert = Credentials.convertToPem(cert);
+ return mService.installKeyPair(who, privKey.getEncoded(), pemCert, alias);
+ } catch (CertificateException e) {
+ Log.w(TAG, "Error encoding certificate", e);
+ } catch (IOException e) {
+ Log.w(TAG, "Error writing certificate", e);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ return false;
+ }
+
+ /**
* Returns the alias of a given CA certificate in the certificate store, or null if it
* doesn't exist.
*/
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 57d8b95..c8e1780 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -126,6 +126,8 @@
void uninstallCaCert(in ComponentName admin, in String alias);
void enforceCanManageCaCerts(in ComponentName admin);
+ boolean installKeyPair(in ComponentName who, in byte[] privKeyBuffer, in byte[] certBuffer, String alias);
+
void addPersistentPreferredActivity(in ComponentName admin, in IntentFilter filter, in ComponentName activity);
void clearPackagePersistentPreferredActivities(in ComponentName admin, String packageName);
diff --git a/core/java/android/app/job/JobParameters.java b/core/java/android/app/job/JobParameters.java
index 724856a..62734f2 100644
--- a/core/java/android/app/job/JobParameters.java
+++ b/core/java/android/app/job/JobParameters.java
@@ -32,12 +32,15 @@
private final int jobId;
private final PersistableBundle extras;
private final IBinder callback;
+ private final boolean overrideDeadlineExpired;
/** @hide */
- public JobParameters(int jobId, PersistableBundle extras, IBinder callback) {
+ public JobParameters(IBinder callback, int jobId, PersistableBundle extras,
+ boolean overrideDeadlineExpired) {
this.jobId = jobId;
this.extras = extras;
this.callback = callback;
+ this.overrideDeadlineExpired = overrideDeadlineExpired;
}
/**
@@ -56,6 +59,16 @@
return extras;
}
+ /**
+ * For jobs with {@link android.app.job.JobInfo.Builder#setOverrideDeadline(long)} set, this
+ * provides an easy way to tell whether the job is being executed due to the deadline
+ * expiring. Note: If the job is running because its deadline expired, it implies that its
+ * constraints will not be met.
+ */
+ public boolean isOverrideDeadlineExpired() {
+ return overrideDeadlineExpired;
+ }
+
/** @hide */
public IJobCallback getCallback() {
return IJobCallback.Stub.asInterface(callback);
@@ -65,6 +78,7 @@
jobId = in.readInt();
extras = in.readPersistableBundle();
callback = in.readStrongBinder();
+ overrideDeadlineExpired = in.readInt() == 1;
}
@Override
@@ -77,6 +91,7 @@
dest.writeInt(jobId);
dest.writePersistableBundle(extras);
dest.writeStrongBinder(callback);
+ dest.writeInt(overrideDeadlineExpired ? 1 : 0);
}
public static final Creator<JobParameters> CREATOR = new Creator<JobParameters>() {
diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl
index 3286627..b5295fb 100644
--- a/core/java/android/os/IUserManager.aidl
+++ b/core/java/android/os/IUserManager.aidl
@@ -41,6 +41,7 @@
int getUserSerialNumber(int userHandle);
int getUserHandle(int userSerialNumber);
Bundle getUserRestrictions(int userHandle);
+ boolean hasUserRestriction(in String restrictionKey, int userHandle);
void setUserRestrictions(in Bundle restrictions, int userHandle);
void setApplicationRestrictions(in String packageName, in Bundle restrictions,
int userHandle);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 33fda4a..c76ff11 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -630,7 +630,13 @@
* @param userHandle the UserHandle of the user for whom to retrieve the restrictions.
*/
public boolean hasUserRestriction(String restrictionKey, UserHandle userHandle) {
- return getUserRestrictions(userHandle).getBoolean(restrictionKey, false);
+ try {
+ return mService.hasUserRestriction(restrictionKey,
+ userHandle.getIdentifier());
+ } catch (RemoteException re) {
+ Log.w(TAG, "Could not check user restrictions", re);
+ return false;
+ }
}
/**
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index edb3798..d23e115 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -339,7 +339,8 @@
* @param attachInfo AttachInfo tied to the specified view.
* @param callbacks Callbacks invoked when drawing happens.
*/
- abstract void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks);
+ abstract void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks,
+ boolean isStartingWindow);
/**
* Creates a new hardware layer. A hardware layer built by calling this
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 5d2822d..3d1332c 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -16,6 +16,7 @@
package android.view;
+import android.graphics.Color;
import com.android.internal.R;
import android.content.Context;
@@ -267,7 +268,8 @@
view.mRecreateDisplayList = false;
}
- private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks) {
+ private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks,
+ boolean isStartingWindow) {
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "getDisplayList");
updateViewTreeDisplayList(view);
@@ -279,6 +281,12 @@
callbacks.onHardwarePreDraw(canvas);
canvas.insertReorderBarrier();
+ if (isStartingWindow) {
+ // Compensate for some situations in which a hw-accelerated surface
+ // will not be filled with anything by default; this is equivalent
+ // to the old behavior when the system process was not hw-accelerated
+ canvas.drawColor(Color.BLACK);
+ }
canvas.drawRenderNode(view.getDisplayList());
canvas.insertInorderBarrier();
@@ -298,7 +306,8 @@
}
@Override
- void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks) {
+ void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks,
+ boolean isStartingWindow) {
attachInfo.mIgnoreDirtyState = true;
long frameTimeNanos = mChoreographer.getFrameTimeNanos();
attachInfo.mDrawingTime = frameTimeNanos / TimeUtils.NANOS_PER_MS;
@@ -308,7 +317,7 @@
recordDuration = System.nanoTime();
}
- updateRootDisplayList(view, callbacks);
+ updateRootDisplayList(view, callbacks, isStartingWindow);
if (mProfilingEnabled) {
recordDuration = System.nanoTime() - recordDuration;
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 43ab4ef..ae6e4e7 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -711,17 +711,10 @@
// can be used by code on the system process to escape that and enable
// HW accelerated drawing. (This is basically for the lock screen.)
- final boolean fakeHwAccelerated = (attrs.privateFlags &
- WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED) != 0;
final boolean forceHwAccelerated = (attrs.privateFlags &
WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED) != 0;
- if (fakeHwAccelerated) {
- // This is exclusively for the preview windows the window manager
- // shows for launching applications, so they will look more like
- // the app being launched.
- mAttachInfo.mHardwareAccelerationRequested = true;
- } else if (!HardwareRenderer.sRendererDisabled
+ if (!HardwareRenderer.sRendererDisabled
|| (HardwareRenderer.sSystemRendererDisabled && forceHwAccelerated)) {
if (mAttachInfo.mHardwareRenderer != null) {
mAttachInfo.mHardwareRenderer.destroy();
@@ -2486,7 +2479,8 @@
dirty.setEmpty();
mBlockResizeBuffer = false;
- mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
+ mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this,
+ params.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
} else {
// If we get here with a disabled & requested hardware renderer, something went
// wrong (an invalidate posted right before we destroyed the hardware surface
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 47ee52e..273ec9d 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1024,26 +1024,6 @@
public int flags;
/**
- * If the window has requested hardware acceleration, but this is not
- * allowed in the process it is in, then still render it as if it is
- * hardware accelerated. This is used for the starting preview windows
- * in the system process, which don't need to have the overhead of
- * hardware acceleration (they are just a static rendering), but should
- * be rendered as such to match the actual window of the app even if it
- * is hardware accelerated.
- * Even if the window isn't hardware accelerated, still do its rendering
- * as if it was.
- * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
- * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
- * is generally disabled. This flag must be specified in addition to
- * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
- * windows.
- *
- * @hide
- */
- public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
-
- /**
* In the system process, we globally do not use hardware acceleration
* because there are many threads doing UI there and they conflict.
* If certain parts of the UI that really do want to use hardware
diff --git a/core/java/com/android/server/BootReceiver.java b/core/java/com/android/server/BootReceiver.java
index 7249985..468d7f1 100644
--- a/core/java/com/android/server/BootReceiver.java
+++ b/core/java/com/android/server/BootReceiver.java
@@ -123,8 +123,15 @@
}
if (SystemProperties.getLong("ro.runtime.firstboot", 0) == 0) {
- String now = Long.toString(System.currentTimeMillis());
- SystemProperties.set("ro.runtime.firstboot", now);
+ if ("encrypted".equals(SystemProperties.get("ro.crypto.state"))
+ && "trigger_restart_min_framework".equals(SystemProperties.get("vold.decrypt"))){
+ // Encrypted, first boot to get PIN/pattern/password so data is tmpfs
+ // Don't set ro.runtime.firstboot so that we will do this again
+ // when data is properly mounted
+ } else {
+ String now = Long.toString(System.currentTimeMillis());
+ SystemProperties.set("ro.runtime.firstboot", now);
+ }
if (db != null) db.addText("SYSTEM_BOOT", headers);
// Negative sizes mean to take the *tail* of the file (see FileUtils.readTextFile())
diff --git a/core/res/res/layout/preference_material.xml b/core/res/res/layout/preference_material.xml
index a137149..39c979c 100644
--- a/core/res/res/layout/preference_material.xml
+++ b/core/res/res/layout/preference_material.xml
@@ -42,6 +42,7 @@
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:adjustViewBounds="true"
android:maxWidth="48dp"
android:maxHeight="48dp" />
</LinearLayout>
diff --git a/core/res/res/values-mcc310-mnc120/config.xml b/core/res/res/values-mcc310-mnc120/config.xml
index 62001d9..24e55b1 100644
--- a/core/res/res/values-mcc310-mnc120/config.xml
+++ b/core/res/res/values-mcc310-mnc120/config.xml
@@ -25,4 +25,6 @@
-->
<integer name="config_mobile_mtu">1422</integer>
+ <!-- Sprint need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">70</integer>
</resources>
diff --git a/core/res/res/values-mcc311-mnc220/config.xml b/core/res/res/values-mcc311-mnc220/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc220/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc221/config.xml b/core/res/res/values-mcc311-mnc221/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc221/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc222/config.xml b/core/res/res/values-mcc311-mnc222/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc222/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc223/config.xml b/core/res/res/values-mcc311-mnc223/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc223/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc224/config.xml b/core/res/res/values-mcc311-mnc224/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc224/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc225/config.xml b/core/res/res/values-mcc311-mnc225/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc225/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc226/config.xml b/core/res/res/values-mcc311-mnc226/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc226/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc227/config.xml b/core/res/res/values-mcc311-mnc227/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc227/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc228/config.xml b/core/res/res/values-mcc311-mnc228/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc228/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc229/config.xml b/core/res/res/values-mcc311-mnc229/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc229/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc490/config.xml b/core/res/res/values-mcc311-mnc490/config.xml
new file mode 100644
index 0000000..defe78d
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc490/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Sprint need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">70</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc580/config.xml b/core/res/res/values-mcc311-mnc580/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc580/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc581/config.xml b/core/res/res/values-mcc311-mnc581/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc581/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc582/config.xml b/core/res/res/values-mcc311-mnc582/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc582/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc583/config.xml b/core/res/res/values-mcc311-mnc583/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc583/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc584/config.xml b/core/res/res/values-mcc311-mnc584/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc584/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc585/config.xml b/core/res/res/values-mcc311-mnc585/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc585/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc586/config.xml b/core/res/res/values-mcc311-mnc586/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc586/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc587/config.xml b/core/res/res/values-mcc311-mnc587/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc587/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc588/config.xml b/core/res/res/values-mcc311-mnc588/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc588/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc589/config.xml b/core/res/res/values-mcc311-mnc589/config.xml
new file mode 100644
index 0000000..811e9c7
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc589/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2014, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- USC need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">300</integer>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc870/config.xml b/core/res/res/values-mcc311-mnc870/config.xml
new file mode 100644
index 0000000..24e55b1
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc870/config.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2013, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Configure mobile network MTU. Carrier specific value is set here.
+ -->
+ <integer name="config_mobile_mtu">1422</integer>
+
+ <!-- Sprint need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">70</integer>
+</resources>
diff --git a/core/res/res/values-mcc312-mnc530/config.xml b/core/res/res/values-mcc312-mnc530/config.xml
new file mode 100644
index 0000000..24e55b1
--- /dev/null
+++ b/core/res/res/values-mcc312-mnc530/config.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2013, 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 my 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Configure mobile network MTU. Carrier specific value is set here.
+ -->
+ <integer name="config_mobile_mtu">1422</integer>
+
+ <!-- Sprint need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">70</integer>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index d67690a..3907fc5 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -360,6 +360,9 @@
<!-- Boolean indicating associated network selection is allowed -->
<bool translatable="false" name="config_wifi_framework_enable_associated_network_selection">true</bool>
+ <!-- Boolean indicating that wifi only link configuratios that have exact same credentials (i.e PSK) -->
+ <bool translatable="false" name="config_wifi_only_link_same_credential_configurations">true</bool>
+
<!-- Wifi driver stop delay, in milliseconds.
Default value is 2 minutes. -->
<integer translatable="false" name="config_wifi_driver_stop_delay">120000</integer>
@@ -1746,4 +1749,7 @@
(3) If the config_default_vm_number array has gid special item but it doesn't match the
current sim's gid, the last one without gid will be picked -->
<string-array translatable="false" name="config_default_vm_number" />
+
+ <!-- Sprint need a 70 ms delay for 3way call -->
+ <integer name="config_cdma_3waycall_flash_delay">0</integer>
</resources>
diff --git a/core/res/res/values/styles_leanback.xml b/core/res/res/values/styles_leanback.xml
index 7606c86..aaeaadd 100644
--- a/core/res/res/values/styles_leanback.xml
+++ b/core/res/res/values/styles_leanback.xml
@@ -36,24 +36,28 @@
<!-- Setup and form wizard themes -->
<style name="TextAppearance.Leanback.FormWizard" parent="@style/TextAppearance.Material">
<item name="textSize">18sp</item>
+ <item name="lineSpacingExtra">24sp</item>
<item name="fontFamily">sans-serif-light</item>
<item name="textColor">?attr/textColorPrimary</item>
</style>
<style name="TextAppearance.Leanback.FormWizard.Small" parent="@style/TextAppearance.Material.Small">
- <item name="textSize">18sp</item>
+ <item name="textSize">14sp</item>
+ <item name="lineSpacingExtra">24sp</item>
<item name="fontFamily">sans-serif-light</item>
<item name="textColor">?attr/textColorPrimary</item>
</style>
<style name="TextAppearance.Leanback.FormWizard.Medium" parent="@style/TextAppearance.Material.Medium">
<item name="textSize">36sp</item>
+ <item name="lineSpacingExtra">40sp</item>
<item name="fontFamily">sans-serif-thin</item>
<item name="textColor">?attr/textColorPrimary</item>
</style>
<style name="TextAppearance.Leanback.FormWizard.Large" parent="@style/TextAppearance.Material.Large">
- <item name="textSize">56sp</item>
+ <item name="textSize">42sp</item>
+ <item name="lineSpacingExtra">48sp</item>
<item name="fontFamily">sans-serif-thin</item>
<item name="textColor">?attr/textColorPrimary</item>
</style>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 221269d..7fc522f 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -296,7 +296,7 @@
<java-symbol type="bool" name="config_windowEnableCircularEmulatorDisplayOverlay" />
<java-symbol type="bool" name="config_wifi_framework_enable_associated_autojoin_scan" />
<java-symbol type="bool" name="config_wifi_framework_enable_associated_network_selection" />
-
+ <java-symbol type="bool" name="config_wifi_only_link_same_credential_configurations" />
<java-symbol type="integer" name="config_bluetooth_max_advertisers" />
<java-symbol type="integer" name="config_bluetooth_max_scan_filters" />
<java-symbol type="integer" name="config_cursorWindowSize" />
@@ -2014,4 +2014,5 @@
<java-symbol type="attr" name="closeItemLayout" />
<java-symbol type="layout" name="resolver_different_item_header" />
<java-symbol type="array" name="config_default_vm_number" />
+ <java-symbol type="integer" name="config_cdma_3waycall_flash_delay"/>
</resources>
diff --git a/keystore/java/android/security/IKeyChainService.aidl b/keystore/java/android/security/IKeyChainService.aidl
index a93891a..20c94c5 100644
--- a/keystore/java/android/security/IKeyChainService.aidl
+++ b/keystore/java/android/security/IKeyChainService.aidl
@@ -31,6 +31,9 @@
// APIs used by CertInstaller
void installCaCertificate(in byte[] caCertificate);
+ // APIs used by DevicePolicyManager
+ boolean installKeyPair(in byte[] privateKey, in byte[] userCert, String alias);
+
// APIs used by Settings
boolean deleteCaCertificate(String alias);
boolean reset();
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index dbd273d..31cc1c8 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -54,10 +54,6 @@
namespace android {
namespace uirenderer {
-///////////////////////////////////////////////////////////////////////////////
-// Defines
-///////////////////////////////////////////////////////////////////////////////
-
static GLenum getFilter(const SkPaint* paint) {
if (!paint || paint->getFilterLevel() != SkPaint::kNone_FilterLevel) {
return GL_LINEAR;
@@ -3044,21 +3040,35 @@
}
void OpenGLRenderer::setupPaintFilter(int clearBits, int setBits) {
+ // TODO: don't bother with boolean, it's redundant with clear/set bits
mDrawModifiers.mHasDrawFilter = true;
mDrawModifiers.mPaintFilterClearBits = clearBits & SkPaint::kAllFlags;
mDrawModifiers.mPaintFilterSetBits = setBits & SkPaint::kAllFlags;
}
const SkPaint* OpenGLRenderer::filterPaint(const SkPaint* paint) {
+ // TODO: use CompatFlagsDrawFilter here, and combine logic with android/graphics/DrawFilter.cpp
+ // to avoid clobbering 0x02 paint flag
+
+ // Equivalent to the Java Paint's FILTER_BITMAP_FLAG.
+ static const uint32_t sFilterBitmapFlag = 0x02;
+
if (CC_LIKELY(!mDrawModifiers.mHasDrawFilter || !paint)) {
return paint;
}
- uint32_t flags = paint->getFlags();
+ const uint32_t clearBits = mDrawModifiers.mPaintFilterClearBits;
+ const uint32_t setBits = mDrawModifiers.mPaintFilterSetBits;
+ const uint32_t flags = (paint->getFlags() & ~clearBits) | setBits;
mFilteredPaint = *paint;
- mFilteredPaint.setFlags((flags & ~mDrawModifiers.mPaintFilterClearBits) |
- mDrawModifiers.mPaintFilterSetBits);
+ mFilteredPaint.setFlags(flags);
+
+ // check if paint filter trying to override bitmap filter
+ if ((clearBits | setBits) & sFilterBitmapFlag) {
+ mFilteredPaint.setFilterLevel(flags & sFilterBitmapFlag
+ ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel);
+ }
return &mFilteredPaint;
}
diff --git a/media/java/android/media/projection/IMediaProjection.aidl b/media/java/android/media/projection/IMediaProjection.aidl
index 3d25aa6..19fc052 100644
--- a/media/java/android/media/projection/IMediaProjection.aidl
+++ b/media/java/android/media/projection/IMediaProjection.aidl
@@ -26,6 +26,6 @@
boolean canProjectVideo();
boolean canProjectSecureVideo();
int applyVirtualDisplayFlags(int flags);
- void addCallback(IMediaProjectionCallback callback);
- void removeCallback(IMediaProjectionCallback callback);
+ void registerCallback(IMediaProjectionCallback callback);
+ void unregisterCallback(IMediaProjectionCallback callback);
}
diff --git a/media/java/android/media/projection/MediaProjection.java b/media/java/android/media/projection/MediaProjection.java
index 3a74d93..e6dadf9 100644
--- a/media/java/android/media/projection/MediaProjection.java
+++ b/media/java/android/media/projection/MediaProjection.java
@@ -40,7 +40,7 @@
*
* <p>
* A screen capture session can be started through {@link
- * MediaProjectionManager#getScreenCaptureIntent}. This grants the ability to
+ * MediaProjectionManager#createScreenCaptureIntent}. This grants the ability to
* capture screen contents, but not system audio.
* </p>
*/
@@ -70,9 +70,9 @@
* @param handler The handler on which the callback should be invoked, or
* null if the callback should be invoked on the calling thread's looper.
*
- * @see #removeCallback
+ * @see #unregisterCallback
*/
- public void addCallback(Callback callback, Handler handler) {
+ public void registerCallback(Callback callback, Handler handler) {
if (callback == null) {
throw new IllegalArgumentException("callback should not be null");
}
@@ -83,9 +83,9 @@
*
* @param callback The callback to unregister.
*
- * @see #addCallback
+ * @see #registerCallback
*/
- public void removeCallback(Callback callback) {
+ public void unregisterCallback(Callback callback) {
if (callback == null) {
throw new IllegalArgumentException("callback should not be null");
}
diff --git a/media/java/android/media/projection/MediaProjectionManager.java b/media/java/android/media/projection/MediaProjectionManager.java
index 50d66c6..a1cfc35 100644
--- a/media/java/android/media/projection/MediaProjectionManager.java
+++ b/media/java/android/media/projection/MediaProjectionManager.java
@@ -75,7 +75,7 @@
* the user whether to allow screen capture. The result of this
* activity should be passed to getMediaProjection.
*/
- public Intent getScreenCaptureIntent() {
+ public Intent createScreenCaptureIntent() {
Intent i = new Intent();
i.setClassName("com.android.systemui",
"com.android.systemui.media.MediaProjectionPermissionActivity");
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 5a1c318..f899572 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -191,11 +191,21 @@
<!-- Doze: maximum brightness to use when pulsing -->
<integer name="doze_pulse_brightness">40</integer>
- <!-- Doze: number of pulses when doing multiple pulses in quick succession -->
- <integer name="doze_multipulse_count">3</integer>
+ <!-- Doze: period of time between pulses (start of pulse) when following the notification light
+ Format: <under_ms>:<period_ms>,...,<default_ms> -->
+ <string name="doze_pulse_period_function">60000:10000,300000:30000,1800000:60000,0</string>
- <!-- Doze: interval between pulses when following the notification light -->
- <integer name="doze_notification_pulse_interval">30000</integer>
+ <!-- Doze: pulse parameter - how long does it take to fade in? -->
+ <integer name="doze_pulse_duration_in">1000</integer>
+
+ <!-- Doze: pulse parameter - once faded in, how long does it stay visible? -->
+ <integer name="doze_pulse_duration_visible">3000</integer>
+
+ <!-- Doze: pulse parameter - how long does it take to fade out? -->
+ <integer name="doze_pulse_duration_out">1000</integer>
+
+ <!-- Doze: pulse parameter - how long to wait before pulsing (if not starting immediately) -->
+ <integer name="doze_pulse_delay">1000</integer>
<!-- Doze: alpha to apply to small icons when dozing -->
<integer name="doze_small_icon_alpha">222</integer><!-- 87% of 0xff -->
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index d17e263..1183582 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -42,6 +42,7 @@
import com.android.systemui.R;
import com.android.systemui.SystemUIApplication;
+import com.android.systemui.statusbar.phone.DozeParameters;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -54,11 +55,11 @@
private static final String ACTION_BASE = "com.android.systemui.doze";
private static final String PULSE_ACTION = ACTION_BASE + ".pulse";
private static final String NOTIFICATION_PULSE_ACTION = ACTION_BASE + ".notification_pulse";
- private static final String EXTRA_PULSES = "pulses";
private final String mTag = String.format(TAG + ".%08x", hashCode());
private final Context mContext = this;
private final Handler mHandler = new Handler();
+ private final DozeParameters mDozeParameters = new DozeParameters(mContext);
private Host mHost;
private SensorManager mSensors;
@@ -74,9 +75,8 @@
private int mDisplayStateWhenOn;
private boolean mNotificationLightOn;
private PendingIntent mNotificationPulseIntent;
- private int mMultipulseCount;
- private int mNotificationPulseInterval;
private boolean mPowerSaveActive;
+ private long mNotificationPulseTime;
public DozeService() {
if (DEBUG) Log.d(mTag, "new DozeService()");
@@ -94,9 +94,9 @@
pw.print(" mMaxBrightness: "); pw.println(mMaxBrightness);
pw.print(" mDisplayStateSupported: "); pw.println(mDisplayStateSupported);
pw.print(" mNotificationLightOn: "); pw.println(mNotificationLightOn);
- pw.print(" mMultipulseCount: "); pw.println(mMultipulseCount);
- pw.print(" mNotificationPulseInterval: "); pw.println(mNotificationPulseInterval);
pw.print(" mPowerSaveActive: "); pw.println(mPowerSaveActive);
+ pw.print(" mNotificationPulseTime: "); pw.println(mNotificationPulseTime);
+ mDozeParameters.dump(pw);
}
@Override
@@ -127,11 +127,7 @@
BRIGHTNESS_OFF, BRIGHTNESS_ON);
mNotificationPulseIntent = PendingIntent.getBroadcast(mContext, 0,
new Intent(NOTIFICATION_PULSE_ACTION).setPackage(getPackageName()),
- PendingIntent.FLAG_CANCEL_CURRENT);
- mMultipulseCount = SystemProperties.getInt("doze.multipulses",
- res.getInteger(R.integer.doze_multipulse_count));
- mNotificationPulseInterval = SystemProperties.getInt("doze.notification.pulse",
- res.getInteger(R.integer.doze_notification_pulse_interval));
+ PendingIntent.FLAG_UPDATE_CURRENT);
mDisplayStateWhenOn = mDisplayStateSupported ? Display.STATE_DOZE : Display.STATE_ON;
setDozeScreenState(mDisplayStateWhenOn);
}
@@ -159,6 +155,7 @@
public void stayAwake(long millis) {
if (mDreaming && millis > 0) {
+ if (DEBUG) Log.d(mTag, "stayAwake millis=" + millis);
mWakeLock.acquire(millis);
setDozeScreenState(mDisplayStateWhenOn);
setDozeScreenBrightness(mMaxBrightness);
@@ -218,21 +215,9 @@
}
}
- private void requestMultipulse() {
- requestPulse(mMultipulseCount);
- }
-
- private void requestPulse() {
- requestPulse(1);
- }
-
- private void requestPulse(int pulses) {
- requestPulse(pulses, true /*delayed*/);
- }
-
- private void requestPulse(int pulses, boolean delayed) {
+ private void requestPulse(boolean delayed) {
if (mHost != null) {
- mHost.requestPulse(pulses, delayed, this);
+ mHost.requestPulse(delayed, this);
}
}
@@ -281,9 +266,14 @@
private void rescheduleNotificationPulse() {
mAlarmManager.cancel(mNotificationPulseIntent);
if (mNotificationLightOn) {
- final long time = System.currentTimeMillis() + mNotificationPulseInterval;
- if (DEBUG) Log.d(TAG, "Scheduling pulse for " + new Date(time));
- mAlarmManager.setExact(AlarmManager.RTC_WAKEUP, time, mNotificationPulseIntent);
+ final long now = System.currentTimeMillis();
+ final long age = now - mNotificationPulseTime;
+ final long period = mDozeParameters.getPulsePeriod(age);
+ final long time = now + period;
+ if (period > 0) {
+ if (DEBUG) Log.d(TAG, "Scheduling pulse in " + period + " for " + new Date(time));
+ mAlarmManager.setExact(AlarmManager.RTC_WAKEUP, time, mNotificationPulseIntent);
+ }
}
}
@@ -314,11 +304,11 @@
public void onReceive(Context context, Intent intent) {
if (PULSE_ACTION.equals(intent.getAction())) {
if (DEBUG) Log.d(mTag, "Received pulse intent");
- requestPulse(intent.getIntExtra(EXTRA_PULSES, mMultipulseCount));
+ requestPulse(false /*delayed*/);
}
if (NOTIFICATION_PULSE_ACTION.equals(intent.getAction())) {
if (DEBUG) Log.d(mTag, "Received notification pulse intent");
- requestPulse();
+ requestPulse(true /*delayed*/);
rescheduleNotificationPulse();
}
}
@@ -334,7 +324,8 @@
@Override
public void onBuzzBeepBlinked() {
if (DEBUG) Log.d(mTag, "onBuzzBeepBlinked");
- requestMultipulse();
+ mNotificationPulseTime = System.currentTimeMillis();
+ requestPulse(true /*delayed*/);
}
@Override
@@ -342,6 +333,10 @@
if (DEBUG) Log.d(mTag, "onNotificationLight on=" + on);
if (mNotificationLightOn == on) return;
mNotificationLightOn = on;
+ if (mNotificationLightOn) {
+ mNotificationPulseTime = System.currentTimeMillis();
+ requestPulse(true /*delayed*/);
+ }
rescheduleNotificationPulse();
}
@@ -358,7 +353,7 @@
void addCallback(Callback callback);
void removeCallback(Callback callback);
void requestDoze(DozeService dozeService);
- void requestPulse(int pulses, boolean delayed, DozeService dozeService);
+ void requestPulse(boolean delayed, DozeService dozeService);
void dozingStopped(DozeService dozeService);
boolean isPowerSaveActive();
@@ -409,7 +404,7 @@
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION).build());
}
}
- requestPulse(1, false /*delayed*/);
+ requestPulse(false /*delayed*/);
setListening(true); // reregister, this sensor only fires once
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
new file mode 100644
index 0000000..e14ef12
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2014 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.systemui.statusbar.phone;
+
+import android.content.Context;
+import android.os.SystemProperties;
+import android.text.TextUtils;
+import android.util.Log;
+import android.util.MathUtils;
+
+import com.android.systemui.R;
+
+import java.io.PrintWriter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class DozeParameters {
+ private static final String TAG = "DozeParameters";
+
+ private static final int MAX_DURATION = 10 * 1000;
+
+ private final Context mContext;
+
+ private StepFunction mPulsePeriodFunction;
+
+ public DozeParameters(Context context) {
+ mContext = context;
+ }
+
+ public void dump(PrintWriter pw) {
+ pw.println(" DozeParameters:");
+ pw.print(" getPulseDuration(): "); pw.println(getPulseDuration());
+ pw.print(" getPulseInDuration(): "); pw.println(getPulseInDuration());
+ pw.print(" getPulseInVisibleDuration(): "); pw.println(getPulseVisibleDuration());
+ pw.print(" getPulseOutDuration(): "); pw.println(getPulseOutDuration());
+ pw.print(" getPulseStartDelay(): "); pw.println(getPulseStartDelay());
+ pw.print(" getPulsePeriodFunction(): "); pw.println(getPulsePeriodFunction());
+ }
+
+ public int getPulseDuration() {
+ return getPulseInDuration() + getPulseVisibleDuration() + getPulseOutDuration();
+ }
+
+ public int getPulseInDuration() {
+ return getInt("doze.pulse.duration.in", R.integer.doze_pulse_duration_in);
+ }
+
+ public int getPulseVisibleDuration() {
+ return getInt("doze.pulse.duration.visible", R.integer.doze_pulse_duration_visible);
+ }
+
+ public int getPulseOutDuration() {
+ return getInt("doze.pulse.duration.out", R.integer.doze_pulse_duration_out);
+ }
+
+ public int getPulseStartDelay() {
+ return getInt("doze.pulse.delay", R.integer.doze_pulse_delay);
+ }
+
+ public long getPulsePeriod(long age) {
+ final String spec = getPulsePeriodFunction();
+ if (mPulsePeriodFunction == null || !mPulsePeriodFunction.mSpec.equals(spec)) {
+ mPulsePeriodFunction = StepFunction.parse(spec);
+ }
+ return mPulsePeriodFunction != null ? mPulsePeriodFunction.evaluate(age) : 0;
+ }
+
+ private String getPulsePeriodFunction() {
+ return getString("doze.pulse.period.function", R.string.doze_pulse_period_function);
+ }
+
+ private int getInt(String propName, int resId) {
+ int value = SystemProperties.getInt(propName, mContext.getResources().getInteger(resId));
+ return MathUtils.constrain(value, 0, MAX_DURATION);
+ }
+
+ private String getString(String propName, int resId) {
+ return SystemProperties.get(propName, mContext.getString(resId));
+ }
+
+ private static class StepFunction {
+ private static final Pattern PATTERN = Pattern.compile("(\\d+?)(:(\\d+?))?", 0);
+
+ private String mSpec;
+ private long[] mSteps;
+ private long[] mValues;
+ private long mDefault;
+
+ public static StepFunction parse(String spec) {
+ if (TextUtils.isEmpty(spec)) return null;
+ try {
+ final StepFunction rt = new StepFunction();
+ rt.mSpec = spec;
+ final String[] tokens = spec.split(",");
+ rt.mSteps = new long[tokens.length - 1];
+ rt.mValues = new long[tokens.length - 1];
+ for (int i = 0; i < tokens.length - 1; i++) {
+ final Matcher m = PATTERN.matcher(tokens[i]);
+ if (!m.matches()) throw new IllegalArgumentException("Bad token: " + tokens[i]);
+ rt.mSteps[i] = Long.parseLong(m.group(1));
+ rt.mValues[i] = Long.parseLong(m.group(3));
+ }
+ rt.mDefault = Long.parseLong(tokens[tokens.length - 1]);
+ return rt;
+ } catch (RuntimeException e) {
+ Log.w(TAG, "Error parsing spec: " + spec, e);
+ return null;
+ }
+ }
+
+ public long evaluate(long x) {
+ for (int i = 0; i < mSteps.length; i++) {
+ if (x < mSteps[i]) return mValues[i];
+ }
+ return mDefault;
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 5d4c831..271383f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -3949,7 +3949,8 @@
}
public void wakeUpIfDozing(long time) {
- if (mDozeServiceHost != null && mDozeServiceHost.isDozing()) {
+ if (mDozeServiceHost != null && mDozeServiceHost.isDozing()
+ && mScrimController.isPulsing()) {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.wakeUp(time);
}
@@ -4045,10 +4046,10 @@
}
@Override
- public void requestPulse(int pulses, boolean delayed, DozeService dozeService) {
+ public void requestPulse(boolean delayed, DozeService dozeService) {
if (dozeService == null) return;
dozeService.stayAwake(PROCESSING_TIME);
- mHandler.obtainMessage(H.REQUEST_PULSE, pulses, delayed ? 1 : 0, dozeService)
+ mHandler.obtainMessage(H.REQUEST_PULSE, delayed ? 1 : 0, 0, dozeService)
.sendToTarget();
}
@@ -4073,9 +4074,9 @@
mCurrentDozeService.startDozing();
}
- private void handleRequestPulse(int pulses, boolean delayed, DozeService dozeService) {
+ private void handleRequestPulse(boolean delayed, DozeService dozeService) {
if (!dozeService.equals(mCurrentDozeService)) return;
- final long stayAwake = mScrimController.pulse(pulses, delayed);
+ final long stayAwake = mScrimController.pulse(delayed);
mCurrentDozeService.stayAwake(stayAwake);
}
@@ -4099,7 +4100,7 @@
if (msg.what == REQUEST_DOZE) {
handleRequestDoze((DozeService) msg.obj);
} else if (msg.what == REQUEST_PULSE) {
- handleRequestPulse(msg.arg1, msg.arg2 != 0, (DozeService) msg.obj);
+ handleRequestPulse(msg.arg1 != 0, (DozeService) msg.obj);
} else if (msg.what == DOZING_STOPPED) {
handleDozingStopped((DozeService) msg.obj);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index be48df7..57e5755 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -19,6 +19,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
+import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.Log;
@@ -36,7 +37,7 @@
*/
public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
private static final String TAG = "ScrimController";
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
public static final long ANIMATION_DURATION = 220;
@@ -46,17 +47,10 @@
private static final float SCRIM_IN_FRONT_ALPHA = 0.75f;
private static final int TAG_KEY_ANIM = R.id.scrim;
- private static final long PULSE_IN_ANIMATION_DURATION = 1000;
- private static final long PULSE_VISIBLE_DURATION = 3000;
- private static final long PULSE_OUT_ANIMATION_DURATION = 1000;
- private static final long PULSE_INVISIBLE_DURATION = 1000;
- private static final long PULSE_DURATION = PULSE_IN_ANIMATION_DURATION
- + PULSE_VISIBLE_DURATION + PULSE_OUT_ANIMATION_DURATION + PULSE_INVISIBLE_DURATION;
- private static final long PRE_PULSE_DELAY = 1000;
-
private final View mScrimBehind;
private final View mScrimInFront;
private final UnlockMethodCache mUnlockMethodCache;
+ private final DozeParameters mDozeParameters;
private boolean mKeyguardShowing;
private float mFraction;
@@ -72,16 +66,18 @@
private Runnable mOnAnimationFinished;
private boolean mAnimationStarted;
private boolean mDozing;
- private int mPulsesRemaining;
+ private long mPulseEndTime;
private final Interpolator mInterpolator = new DecelerateInterpolator();
private final Interpolator mLinearOutSlowInInterpolator;
public ScrimController(View scrimBehind, View scrimInFront) {
mScrimBehind = scrimBehind;
mScrimInFront = scrimInFront;
- mUnlockMethodCache = UnlockMethodCache.getInstance(scrimBehind.getContext());
- mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(scrimBehind.getContext(),
+ final Context context = scrimBehind.getContext();
+ mUnlockMethodCache = UnlockMethodCache.getInstance(context);
+ mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
android.R.interpolator.linear_out_slow_in);
+ mDozeParameters = new DozeParameters(context);
}
public void setKeyguardShowing(boolean showing) {
@@ -137,19 +133,28 @@
scheduleUpdate();
}
- /** When dozing, fade screen contents in and out a few times using the front scrim. */
- public long pulse(int pulses, boolean delayed) {
+ /** When dozing, fade screen contents in and out using the front scrim. */
+ public long pulse(boolean delayed) {
if (!mDozing) return 0;
- mPulsesRemaining = Math.max(pulses, mPulsesRemaining);
- final long delay = delayed ? PRE_PULSE_DELAY : 0;
+ final long now = System.currentTimeMillis();
+ if (DEBUG) Log.d(TAG, "pulse delayed=" + delayed + " mPulseEndTime=" + mPulseEndTime
+ + " now=" + now);
+ if (mPulseEndTime != 0 && mPulseEndTime > now) return mPulseEndTime - now;
+ final long delay = delayed ? mDozeParameters.getPulseStartDelay() : 0;
mScrimInFront.postDelayed(mPulseIn, delay);
- return delay + mPulsesRemaining * PULSE_DURATION;
+ mPulseEndTime = now + delay + mDozeParameters.getPulseDuration();
+ return mPulseEndTime - now;
+ }
+
+ public boolean isPulsing() {
+ return mDozing && mPulseEndTime != 0;
}
private void cancelPulsing() {
- mPulsesRemaining = 0;
+ if (DEBUG) Log.d(TAG, "Cancel pulsing");
mScrimInFront.removeCallbacks(mPulseIn);
mScrimInFront.removeCallbacks(mPulseOut);
+ mPulseEndTime = 0;
}
private void scheduleUpdate() {
@@ -302,11 +307,9 @@
private final Runnable mPulseIn = new Runnable() {
@Override
public void run() {
- if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing
- + " mPulsesRemaining=" + mPulsesRemaining);
- if (!mDozing || mPulsesRemaining == 0) return;
- mPulsesRemaining--;
- mDurationOverride = PULSE_IN_ANIMATION_DURATION;
+ if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing);
+ if (!mDozing) return;
+ mDurationOverride = mDozeParameters.getPulseInDuration();
mAnimationDelay = 0;
mAnimateChange = true;
mOnAnimationFinished = mPulseInFinished;
@@ -319,7 +322,7 @@
public void run() {
if (DEBUG) Log.d(TAG, "Pulse in finished, mDozing=" + mDozing);
if (!mDozing) return;
- mScrimInFront.postDelayed(mPulseOut, PULSE_VISIBLE_DURATION);
+ mScrimInFront.postDelayed(mPulseOut, mDozeParameters.getPulseVisibleDuration());
}
};
@@ -328,7 +331,7 @@
public void run() {
if (DEBUG) Log.d(TAG, "Pulse out, mDozing=" + mDozing);
if (!mDozing) return;
- mDurationOverride = PULSE_OUT_ANIMATION_DURATION;
+ mDurationOverride = mDozeParameters.getPulseOutDuration();
mAnimationDelay = 0;
mAnimateChange = true;
mOnAnimationFinished = mPulseOutFinished;
@@ -339,10 +342,8 @@
private final Runnable mPulseOutFinished = new Runnable() {
@Override
public void run() {
- if (DEBUG) Log.d(TAG, "Pulse out finished, mPulsesRemaining=" + mPulsesRemaining);
- if (mPulsesRemaining > 0) {
- mScrimInFront.postDelayed(mPulseIn, PULSE_INVISIBLE_DURATION);
- }
+ if (DEBUG) Log.d(TAG, "Pulse out finished");
+ mPulseEndTime = 0;
}
};
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index a5217ab..42cfd39 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -100,6 +100,11 @@
if (!down) {
return mService.onSpacePressed();
}
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ if (down) {
+ mService.wakeUpIfDozing(event.getEventTime());
+ }
}
if (mService.interceptMediaKey(event)) {
return true;
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 16bb00b..9daa190 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1826,8 +1826,6 @@
params.packageName = packageName;
params.windowAnimations = win.getWindowStyle().getResourceId(
com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
- params.privateFlags |=
- WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
if (!compatInfo.supportsScreen()) {
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index e9419ad..b04cc19 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -1535,7 +1535,7 @@
for (int i=0; i<triggerList.size(); i++) {
Alarm alarm = triggerList.get(i);
try {
- if (localLOGV) Slog.v(TAG, "sending alarm " + alarm);
+ Slog.v(TAG, "sending alarm " + alarm);
alarm.operation.send(getContext(), 0,
mBackgroundIntent.putExtra(
Intent.EXTRA_ALARM_COUNT, alarm.count),
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 4f179ce..a490ac6 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -180,6 +180,7 @@
import android.os.SystemProperties;
import android.os.UpdateLock;
import android.os.UserHandle;
+import android.os.UserManager;
import android.provider.Settings;
import android.text.format.DateUtils;
import android.text.format.Time;
@@ -3369,6 +3370,16 @@
}
}
+ void enforceShellRestriction(String restriction, int userHandle) {
+ if (Binder.getCallingUid() == Process.SHELL_UID) {
+ if (userHandle < 0
+ || mUserManager.hasUserRestriction(restriction, userHandle)) {
+ throw new SecurityException("Shell does not have permission to access user "
+ + userHandle);
+ }
+ }
+ }
+
@Override
public int getFrontActivityScreenCompatMode() {
enforceNotIsolatedCaller("getFrontActivityScreenCompatMode");
@@ -14602,6 +14613,14 @@
throw new IllegalArgumentException(
"Call does not support special user #" + targetUserId);
}
+ // Check shell permission
+ if (callingUid == Process.SHELL_UID && targetUserId >= UserHandle.USER_OWNER) {
+ if (mUserManager.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES,
+ targetUserId)) {
+ throw new SecurityException("Shell does not have permission to access user "
+ + targetUserId + "\n " + Debug.getCallers(3));
+ }
+ }
return targetUserId;
}
@@ -14660,6 +14679,7 @@
Intent service, String resolvedType,
IServiceConnection connection, int flags, int userId) {
enforceNotIsolatedCaller("bindService");
+
// Refuse possible leaked file descriptors
if (service != null && service.hasFileDescriptors() == true) {
throw new IllegalArgumentException("File descriptors passed in Intent");
@@ -15094,12 +15114,18 @@
}
private List<ResolveInfo> collectReceiverComponents(Intent intent, String resolvedType,
- int[] users) {
+ int callingUid, int[] users) {
List<ResolveInfo> receivers = null;
try {
HashSet<ComponentName> singleUserReceivers = null;
boolean scannedFirstReceivers = false;
for (int user : users) {
+ // Skip users that have Shell restrictions
+ if (callingUid == Process.SHELL_UID
+ && getUserManagerLocked().hasUserRestriction(
+ UserManager.DISALLOW_DEBUGGING_FEATURES, user)) {
+ continue;
+ }
List<ResolveInfo> newReceivers = AppGlobals.getPackageManager()
.queryIntentReceivers(intent, resolvedType, STOCK_PM_FLAGS, user);
if (user != 0 && newReceivers != null) {
@@ -15188,7 +15214,6 @@
// Make sure that the user who is receiving this broadcast is started.
// If not, we will just skip it.
-
if (userId != UserHandle.USER_ALL && mStartedUsers.get(userId) == null) {
if (callingUid != Process.SYSTEM_UID || (intent.getFlags()
& Intent.FLAG_RECEIVER_BOOT_UPGRADE) == 0) {
@@ -15453,11 +15478,30 @@
// Need to resolve the intent to interested receivers...
if ((intent.getFlags()&Intent.FLAG_RECEIVER_REGISTERED_ONLY)
== 0) {
- receivers = collectReceiverComponents(intent, resolvedType, users);
+ receivers = collectReceiverComponents(intent, resolvedType, callingUid, users);
}
if (intent.getComponent() == null) {
- registeredReceivers = mReceiverResolver.queryIntent(intent,
- resolvedType, false, userId);
+ if (userId == UserHandle.USER_ALL && callingUid == Process.SHELL_UID) {
+ // Query one target user at a time, excluding shell-restricted users
+ UserManagerService ums = getUserManagerLocked();
+ for (int i = 0; i < users.length; i++) {
+ if (ums.hasUserRestriction(
+ UserManager.DISALLOW_DEBUGGING_FEATURES, users[i])) {
+ continue;
+ }
+ List<BroadcastFilter> registeredReceiversForUser =
+ mReceiverResolver.queryIntent(intent,
+ resolvedType, false, users[i]);
+ if (registeredReceivers == null) {
+ registeredReceivers = registeredReceiversForUser;
+ } else if (registeredReceiversForUser != null) {
+ registeredReceivers.addAll(registeredReceiversForUser);
+ }
+ }
+ } else {
+ registeredReceivers = mReceiverResolver.queryIntent(intent,
+ resolvedType, false, userId);
+ }
}
final boolean replacePending =
@@ -15619,7 +15663,7 @@
enforceNotIsolatedCaller("broadcastIntent");
synchronized(this) {
intent = verifyBroadcastLocked(intent);
-
+
final ProcessRecord callerApp = getRecordForAppLocked(caller);
final int callingPid = Binder.getCallingPid();
final int callingUid = Binder.getCallingUid();
@@ -18027,6 +18071,7 @@
@Override
public boolean switchUser(final int userId) {
+ enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, userId);
String userName;
synchronized (this) {
UserInfo userInfo = getUserManagerLocked().getUserInfo(userId);
@@ -18468,6 +18513,7 @@
if (userId <= 0) {
throw new IllegalArgumentException("Can't stop primary user " + userId);
}
+ enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, userId);
synchronized (this) {
return stopUserLocked(userId, callback);
}
diff --git a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
index f6399a3..a6a9a89 100644
--- a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
@@ -69,7 +69,7 @@
try {
if (projection != null) {
- projection.addCallback(new MediaProjectionCallback(appToken));
+ projection.registerCallback(new MediaProjectionCallback(appToken));
}
appToken.linkToDeath(device, 0);
} catch (RemoteException ex) {
diff --git a/services/core/java/com/android/server/job/JobServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java
index 344c57b..d0447bc 100644
--- a/services/core/java/com/android/server/job/JobServiceContext.java
+++ b/services/core/java/com/android/server/job/JobServiceContext.java
@@ -153,7 +153,8 @@
}
mRunningJob = job;
- mParams = new JobParameters(job.getJobId(), job.getExtras(), this);
+ mParams = new JobParameters(this, job.getJobId(), job.getExtras(),
+ !job.isConstraintsSatisfied());
mExecutionStartTimeElapsed = SystemClock.elapsedRealtime();
mVerb = VERB_BINDING;
diff --git a/services/core/java/com/android/server/job/controllers/JobStatus.java b/services/core/java/com/android/server/job/controllers/JobStatus.java
index f562721..e3c55b6 100644
--- a/services/core/java/com/android/server/job/controllers/JobStatus.java
+++ b/services/core/java/com/android/server/job/controllers/JobStatus.java
@@ -195,16 +195,23 @@
}
/**
- * @return Whether or not this job is ready to run, based on its requirements.
+ * @return Whether or not this job is ready to run, based on its requirements. This is true if
+ * the constraints are satisfied <strong>or</strong> the deadline on the job has expired.
*/
public synchronized boolean isReady() {
+ return isConstraintsSatisfied()
+ || (hasDeadlineConstraint() && deadlineConstraintSatisfied.get());
+ }
+
+ /**
+ * @return Whether the constraints set on this job are satisfied.
+ */
+ public synchronized boolean isConstraintsSatisfied() {
return (!hasChargingConstraint() || chargingConstraintSatisfied.get())
&& (!hasTimingDelayConstraint() || timeDelayConstraintSatisfied.get())
&& (!hasConnectivityConstraint() || connectivityConstraintSatisfied.get())
&& (!hasUnmeteredConstraint() || unmeteredConstraintSatisfied.get())
- && (!hasIdleConstraint() || idleConstraintSatisfied.get())
- // Also ready if the deadline has expired - special case.
- || (hasDeadlineConstraint() && deadlineConstraintSatisfied.get());
+ && (!hasIdleConstraint() || idleConstraintSatisfied.get());
}
public boolean matches(int uid, int jobId) {
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index 8ec9b25..8a1f3ad 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -389,7 +389,7 @@
throw new IllegalStateException(
"Cannot start already started MediaProjection");
}
- addCallback(callback);
+ registerCallback(callback);
try {
mToken = callback.asBinder();
mDeathEater = new IBinder.DeathRecipient() {
@@ -424,7 +424,7 @@
}
@Override
- public void addCallback(IMediaProjectionCallback callback) {
+ public void registerCallback(IMediaProjectionCallback callback) {
if (callback == null) {
throw new IllegalArgumentException("callback must not be null");
}
@@ -432,7 +432,7 @@
}
@Override
- public void removeCallback(IMediaProjectionCallback callback) {
+ public void unregisterCallback(IMediaProjectionCallback callback) {
if (callback == null) {
throw new IllegalArgumentException("callback must not be null");
}
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 9e5fa41..cf19416 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -433,14 +433,12 @@
// listen for configured wifi networks to be removed
final IntentFilter wifiConfigFilter = new IntentFilter(CONFIGURED_NETWORKS_CHANGED_ACTION);
- mContext.registerReceiver(
- mWifiConfigReceiver, wifiConfigFilter, CONNECTIVITY_INTERNAL, mHandler);
+ mContext.registerReceiver(mWifiConfigReceiver, wifiConfigFilter, null, mHandler);
// listen for wifi state changes to catch metered hint
final IntentFilter wifiStateFilter = new IntentFilter(
WifiManager.NETWORK_STATE_CHANGED_ACTION);
- mContext.registerReceiver(
- mWifiStateReceiver, wifiStateFilter, CONNECTIVITY_INTERNAL, mHandler);
+ mContext.registerReceiver(mWifiStateReceiver, wifiStateFilter, null, mHandler);
}
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java
index f995dee..b5aa4d8 100644
--- a/services/core/java/com/android/server/net/NetworkStatsService.java
+++ b/services/core/java/com/android/server/net/NetworkStatsService.java
@@ -318,7 +318,7 @@
// watch for tethering changes
final IntentFilter tetherFilter = new IntentFilter(ACTION_TETHER_STATE_CHANGED);
- mContext.registerReceiver(mTetherReceiver, tetherFilter, CONNECTIVITY_INTERNAL, mHandler);
+ mContext.registerReceiver(mTetherReceiver, tetherFilter, null, mHandler);
// listen for periodic polling events
final IntentFilter pollFilter = new IntentFilter(ACTION_NETWORK_STATS_POLL);
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 496c136..ed678d2 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -446,7 +446,7 @@
private int createSessionInternal(SessionParams params, String installerPackageName, int userId)
throws IOException {
final int callingUid = Binder.getCallingUid();
- mPm.enforceCrossUserPermission(callingUid, userId, true, "createSession");
+ mPm.enforceCrossUserPermission(callingUid, userId, true, false, "createSession");
if (mPm.isUserRestricted(UserHandle.getUserId(callingUid),
UserManager.DISALLOW_INSTALL_APPS)) {
@@ -654,7 +654,7 @@
@Override
public List<SessionInfo> getAllSessions(int userId) {
- mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, "getAllSessions");
+ mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getAllSessions");
final List<SessionInfo> result = new ArrayList<>();
synchronized (mSessions) {
@@ -670,7 +670,7 @@
@Override
public List<SessionInfo> getMySessions(String installerPackageName, int userId) {
- mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, "getMySessions");
+ mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getMySessions");
mAppOps.checkPackage(Binder.getCallingUid(), installerPackageName);
final List<SessionInfo> result = new ArrayList<>();
@@ -688,7 +688,7 @@
@Override
public void uninstall(String packageName, int flags, IntentSender statusReceiver, int userId) {
- mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, "uninstall");
+ mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "uninstall");
final PackageDeleteObserverAdapter adapter = new PackageDeleteObserverAdapter(mContext,
statusReceiver, packageName);
@@ -717,7 +717,7 @@
@Override
public void registerCallback(IPackageInstallerCallback callback, int userId) {
- mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, "registerCallback");
+ mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "registerCallback");
mCallbacks.register(callback, userId);
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index a5e84f6..3e5d514 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -138,6 +138,7 @@
import android.os.Environment;
import android.os.Environment.UserEnvironment;
import android.os.storage.StorageManager;
+import android.os.Debug;
import android.os.FileUtils;
import android.os.Handler;
import android.os.IBinder;
@@ -1845,7 +1846,7 @@
@Override
public boolean isPackageAvailable(String packageName, int userId) {
if (!sUserManager.exists(userId)) return false;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "is package available");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "is package available");
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
if (p != null) {
@@ -1864,7 +1865,7 @@
@Override
public PackageInfo getPackageInfo(String packageName, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get package info");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get package info");
// reader
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
@@ -1909,7 +1910,7 @@
@Override
public int getPackageUid(String packageName, int userId) {
if (!sUserManager.exists(userId)) return -1;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get package uid");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get package uid");
// reader
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
@@ -2059,7 +2060,7 @@
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get application info");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get application info");
// writer
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
@@ -2150,7 +2151,7 @@
@Override
public ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get activity info");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get activity info");
synchronized (mPackages) {
PackageParser.Activity a = mActivities.mActivities.get(component);
@@ -2189,7 +2190,7 @@
@Override
public ActivityInfo getReceiverInfo(ComponentName component, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get receiver info");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get receiver info");
synchronized (mPackages) {
PackageParser.Activity a = mReceivers.mActivities.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
@@ -2207,7 +2208,7 @@
@Override
public ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get service info");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get service info");
synchronized (mPackages) {
PackageParser.Service s = mServices.mServices.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
@@ -2225,7 +2226,7 @@
@Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "get provider info");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get provider info");
synchronized (mPackages) {
PackageParser.Provider p = mProviders.mProviders.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
@@ -2329,13 +2330,17 @@
/**
* Checks if the request is from the system or an app that has INTERACT_ACROSS_USERS
* or INTERACT_ACROSS_USERS_FULL permissions, if the userid is not for the caller.
+ * @param checkShell TODO(yamasani):
* @param message the message to log on security exception
*/
void enforceCrossUserPermission(int callingUid, int userId, boolean requireFullPermission,
- String message) {
+ boolean checkShell, String message) {
if (userId < 0) {
throw new IllegalArgumentException("Invalid userId " + userId);
}
+ if (checkShell) {
+ enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, callingUid, userId);
+ }
if (userId == UserHandle.getUserId(callingUid)) return;
if (callingUid != Process.SYSTEM_UID && callingUid != 0) {
if (requireFullPermission) {
@@ -2353,6 +2358,19 @@
}
}
+ void enforceShellRestriction(String restriction, int callingUid, int userHandle) {
+ if (callingUid == Process.SHELL_UID) {
+ if (userHandle >= 0
+ && sUserManager.hasUserRestriction(restriction, userHandle)) {
+ throw new SecurityException("Shell does not have permission to access user "
+ + userHandle);
+ } else if (userHandle < 0) {
+ Slog.e(TAG, "Unable to check shell permission for user " + userHandle + "\n\t"
+ + Debug.getCallers(3));
+ }
+ }
+ }
+
private BasePermission findPermissionTreeLP(String permName) {
for(BasePermission bp : mSettings.mPermissionTrees.values()) {
if (permName.startsWith(bp.name) &&
@@ -2876,7 +2894,7 @@
public ResolveInfo resolveIntent(Intent intent, String resolvedType,
int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "resolve intent");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "resolve intent");
List<ResolveInfo> query = queryIntentActivities(intent, resolvedType, flags, userId);
return chooseBestActivity(intent, resolvedType, flags, query, userId);
}
@@ -3199,7 +3217,7 @@
public List<ResolveInfo> queryIntentActivities(Intent intent,
String resolvedType, int flags, int userId) {
if (!sUserManager.exists(userId)) return Collections.emptyList();
- enforceCrossUserPermission(Binder.getCallingUid(), userId, false, "query intent activities");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "query intent activities");
ComponentName comp = intent.getComponent();
if (comp == null) {
if (intent.getSelector() != null) {
@@ -3346,7 +3364,7 @@
String resolvedType, int flags, int userId) {
if (!sUserManager.exists(userId)) return Collections.emptyList();
enforceCrossUserPermission(Binder.getCallingUid(), userId, false,
- "query intent activity options");
+ false, "query intent activity options");
final String resultsAction = intent.getAction();
List<ResolveInfo> results = queryIntentActivities(intent, resolvedType, flags
@@ -3642,7 +3660,7 @@
public ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId) {
final boolean listUninstalled = (flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0;
- enforceCrossUserPermission(Binder.getCallingUid(), userId, true, "get installed packages");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "get installed packages");
// writer
synchronized (mPackages) {
@@ -7660,7 +7678,7 @@
final File originFile = new File(originPath);
final int uid = Binder.getCallingUid();
- if (isUserRestricted(UserHandle.getUserId(uid), UserManager.DISALLOW_INSTALL_APPS)) {
+ if (isUserRestricted(userId, UserManager.DISALLOW_INSTALL_APPS)) {
try {
if (observer != null) {
observer.onPackageInstalled("", INSTALL_FAILED_USER_RESTRICTED, null, null);
@@ -7748,11 +7766,8 @@
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null);
PackageSetting pkgSetting;
final int uid = Binder.getCallingUid();
- if (UserHandle.getUserId(uid) != userId) {
- mContext.enforceCallingOrSelfPermission(
- android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
- "setApplicationHiddenSetting for user " + userId);
- }
+ enforceCrossUserPermission(uid, userId, true, true,
+ "setApplicationHiddenSetting for user " + userId);
if (hidden && isPackageDeviceAdmin(packageName, userId)) {
Slog.w(TAG, "Not hiding package " + packageName + ": has active device admin");
@@ -7811,7 +7826,7 @@
public boolean getApplicationHiddenSettingAsUser(String packageName, int userId) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null);
enforceCrossUserPermission(Binder.getCallingUid(), userId, true,
- "getApplicationHidden for user " + userId);
+ false, "getApplicationHidden for user " + userId);
PackageSetting pkgSetting;
long callingId = Binder.clearCallingIdentity();
try {
@@ -7837,7 +7852,8 @@
null);
PackageSetting pkgSetting;
final int uid = Binder.getCallingUid();
- enforceCrossUserPermission(uid, userId, true, "installExistingPackage for user " + userId);
+ enforceCrossUserPermission(uid, userId, true, true, "installExistingPackage for user "
+ + userId);
if (isUserRestricted(userId, UserManager.DISALLOW_INSTALL_APPS)) {
return PackageManager.INSTALL_FAILED_USER_RESTRICTED;
}
@@ -10961,7 +10977,7 @@
final IPackageDataObserver observer, final int userId) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CLEAR_APP_USER_DATA, null);
- enforceCrossUserPermission(Binder.getCallingUid(), userId, true, "clear application data");
+ enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "clear application data");
// Queue up an async operation since the package deletion may take a little while.
mHandler.post(new Runnable() {
public void run() {
@@ -11261,7 +11277,7 @@
String opname) {
// writer
int callingUid = Binder.getCallingUid();
- enforceCrossUserPermission(callingUid, userId, true, "add preferred activity");
+ enforceCrossUserPermission(callingUid, userId, true, false, "add preferred activity");
if (filter.countActions() == 0) {
Slog.w(TAG, "Cannot set a preferred activity with no filter actions");
return;
@@ -11306,7 +11322,7 @@
}
final int callingUid = Binder.getCallingUid();
- enforceCrossUserPermission(callingUid, userId, true, "replace preferred activity");
+ enforceCrossUserPermission(callingUid, userId, true, false, "replace preferred activity");
synchronized (mPackages) {
if (mContext.checkCallingOrSelfPermission(
android.Manifest.permission.SET_PREFERRED_APPLICATIONS)
@@ -11447,6 +11463,7 @@
@Override
public void resetPreferredActivities(int userId) {
+ /* TODO: Actually use userId. Why is it being passed in? */
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
// writer
@@ -11561,6 +11578,7 @@
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
int callingUid = Binder.getCallingUid();
enforceOwnerRights(ownerPackage, ownerUserId, callingUid);
+ enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, callingUid, sourceUserId);
if (intentFilter.countActions() == 0) {
Slog.w(TAG, "Cannot set a crossProfile intent filter with no filter actions");
return;
@@ -11580,6 +11598,7 @@
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
int callingUid = Binder.getCallingUid();
enforceOwnerRights(ownerPackage, ownerUserId, callingUid);
+ enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, callingUid, sourceUserId);
int callingUserId = UserHandle.getUserId(callingUid);
synchronized (mPackages) {
CrossProfileIntentResolver resolver =
@@ -11674,7 +11693,7 @@
final int uid = Binder.getCallingUid();
final int permission = mContext.checkCallingOrSelfPermission(
android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);
- enforceCrossUserPermission(uid, userId, false, "set enabled");
+ enforceCrossUserPermission(uid, userId, false, true, "set enabled");
final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
boolean sendNow = false;
boolean isApp = (className == null);
@@ -11808,7 +11827,7 @@
final int permission = mContext.checkCallingOrSelfPermission(
android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);
final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
- enforceCrossUserPermission(uid, userId, true, "stop package");
+ enforceCrossUserPermission(uid, userId, true, true, "stop package");
// writer
synchronized (mPackages) {
if (mSettings.setPackageStoppedStateLPw(packageName, stopped, allowedByPermission,
@@ -11830,7 +11849,7 @@
public int getApplicationEnabledSetting(String packageName, int userId) {
if (!sUserManager.exists(userId)) return COMPONENT_ENABLED_STATE_DISABLED;
int uid = Binder.getCallingUid();
- enforceCrossUserPermission(uid, userId, false, "get enabled");
+ enforceCrossUserPermission(uid, userId, false, false, "get enabled");
// reader
synchronized (mPackages) {
return mSettings.getApplicationEnabledSettingLPr(packageName, userId);
@@ -11841,7 +11860,7 @@
public int getComponentEnabledSetting(ComponentName componentName, int userId) {
if (!sUserManager.exists(userId)) return COMPONENT_ENABLED_STATE_DISABLED;
int uid = Binder.getCallingUid();
- enforceCrossUserPermission(uid, userId, false, "get component enabled");
+ enforceCrossUserPermission(uid, userId, false, false, "get component enabled");
// reader
synchronized (mPackages) {
return mSettings.getComponentEnabledSettingLPr(componentName, userId);
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index a74e3f1..0dadee7 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -36,6 +36,7 @@
import android.os.PatternMatcher;
import android.os.Process;
import android.os.UserHandle;
+import android.os.UserManager;
import android.util.LogPrinter;
import com.android.internal.util.FastXmlSerializer;
@@ -463,6 +464,7 @@
int vc, int pkgFlags, UserHandle installUser, boolean add,
boolean allowInstall) {
PackageSetting p = mPackages.get(name);
+ UserManagerService userManager = UserManagerService.getInstance();
if (p != null) {
p.primaryCpuAbiString = primaryCpuAbiString;
p.secondaryCpuAbiString = secondaryCpuAbiString;
@@ -540,6 +542,7 @@
Slog.i(PackageManagerService.TAG, "Stopping package " + name, e);
}
List<UserInfo> users = getAllUsers();
+ final int installUserId = installUser != null ? installUser.getIdentifier() : 0;
if (users != null && allowInstall) {
for (UserInfo user : users) {
// By default we consider this app to be installed
@@ -549,8 +552,9 @@
// asked to install for all users, or this is the
// user we are installing for.
final boolean installed = installUser == null
- || installUser.getIdentifier() == UserHandle.USER_ALL
- || installUser.getIdentifier() == user.id;
+ || (installUserId == UserHandle.USER_ALL
+ && !isAdbInstallDisallowed(userManager, user.id))
+ || installUserId == user.id;
p.setUserState(user.id, COMPONENT_ENABLED_STATE_DEFAULT,
installed,
true, // stopped,
@@ -616,7 +620,8 @@
List<UserInfo> users = getAllUsers();
if (users != null) {
for (UserInfo user : users) {
- if (installUser.getIdentifier() == UserHandle.USER_ALL
+ if ((installUser.getIdentifier() == UserHandle.USER_ALL
+ && !isAdbInstallDisallowed(userManager, user.id))
|| installUser.getIdentifier() == user.id) {
boolean installed = p.getInstalled(user.id);
if (!installed) {
@@ -631,6 +636,11 @@
return p;
}
+ boolean isAdbInstallDisallowed(UserManagerService userManager, int userId) {
+ return userManager.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES,
+ userId);
+ }
+
void insertPackageSettingLPw(PackageSetting p, PackageParser.Package pkg) {
p.pkg = pkg;
// pkg.mSetEnabled = p.getEnabled(userId);
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index d032d29..26e0db3 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -33,6 +33,7 @@
import android.graphics.BitmapFactory;
import android.os.Binder;
import android.os.Bundle;
+import android.os.Debug;
import android.os.Environment;
import android.os.FileUtils;
import android.os.Handler;
@@ -480,6 +481,14 @@
}
@Override
+ public boolean hasUserRestriction(String restrictionKey, int userId) {
+ synchronized (mPackagesLock) {
+ Bundle restrictions = mUserRestrictions.get(userId);
+ return restrictions != null ? restrictions.getBoolean(restrictionKey) : false;
+ }
+ }
+
+ @Override
public Bundle getUserRestrictions(int userId) {
// checkManageUsersPermission("getUserRestrictions");
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index e1ade63..a8245e7 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -843,7 +843,7 @@
}
File file = new File(dir, WALLPAPER);
ParcelFileDescriptor fd = ParcelFileDescriptor.open(file,
- MODE_CREATE|MODE_READ_WRITE);
+ MODE_CREATE|MODE_READ_WRITE|MODE_TRUNCATE);
if (!SELinux.restorecon(file)) {
return null;
}
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java
index 81cd602..50e417b 100644
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -568,6 +568,15 @@
mBulkUpdateParams |= SET_UPDATE_ROTATION;
screenRotationAnimation.kill();
displayAnimator.mScreenRotationAnimation = null;
+
+ //TODO (multidisplay): Accessibility supported only for the default display.
+ if (mService.mAccessibilityController != null
+ && displayId == Display.DEFAULT_DISPLAY) {
+ // We just finished rotation animation which means we did not
+ // anounce the rotation and waited for it to end, announce now.
+ mService.mAccessibilityController.onRotationChangedLocked(
+ mService.getDefaultDisplayContentLocked(), mService.mRotation);
+ }
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 54af851..b7e56cb 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -6442,9 +6442,12 @@
}
//TODO (multidisplay): Magnification is supported only for the default display.
- if (mAccessibilityController != null
+ // Announce rotation only if we will not animate as we already have the
+ // windows in final state. Otherwise, we make this call at the rotation end.
+ if (screenRotationAnimation == null && mAccessibilityController != null
&& displayContent.getDisplayId() == Display.DEFAULT_DISPLAY) {
- mAccessibilityController.onRotationChangedLocked(getDefaultDisplayContentLocked(), rotation);
+ mAccessibilityController.onRotationChangedLocked(getDefaultDisplayContentLocked(),
+ rotation);
}
return true;
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 5ad9825..8e82e2a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -44,13 +44,13 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
+import android.database.ContentObserver;
+import android.hardware.usb.UsbManager;
import android.media.AudioManager;
import android.media.IAudioService;
import android.net.ConnectivityManager;
-import android.net.Uri;
-import android.database.ContentObserver;
-import android.hardware.usb.UsbManager;
import android.net.ProxyInfo;
+import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.Environment;
@@ -69,6 +69,7 @@
import android.os.UserManager;
import android.provider.Settings;
import android.security.Credentials;
+import android.security.IKeyChainService;
import android.security.KeyChain;
import android.security.KeyChain.KeyChainConnection;
import android.util.Log;
@@ -110,6 +111,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
+import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
@@ -2829,6 +2831,35 @@
}
}
+ @Override
+ public boolean installKeyPair(ComponentName who, byte[] privKey, byte[] cert, String alias) {
+ if (who == null) {
+ throw new NullPointerException("ComponentName is null");
+ }
+ synchronized (this) {
+ getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
+ }
+ final UserHandle userHandle = new UserHandle(UserHandle.getCallingUserId());
+ final long id = Binder.clearCallingIdentity();
+ try {
+ final KeyChainConnection keyChainConnection = KeyChain.bindAsUser(mContext, userHandle);
+ try {
+ IKeyChainService keyChain = keyChainConnection.getService();
+ return keyChain.installKeyPair(privKey, cert, alias);
+ } catch (RemoteException e) {
+ Log.e(LOG_TAG, "Installing certificate", e);
+ } finally {
+ keyChainConnection.close();
+ }
+ } catch (InterruptedException e) {
+ Log.w(LOG_TAG, "Interrupted while installing certificate", e);
+ Thread.currentThread().interrupt();
+ } finally {
+ Binder.restoreCallingIdentity(id);
+ }
+ return false;
+ }
+
void wipeDataLocked(int flags) {
// If the SD card is encrypted and non-removable, we have to force a wipe.
boolean forceExtWipe = !Environment.isExternalStorageRemovable() && isExtStorageEncrypted();
@@ -4613,7 +4644,8 @@
@Override
public void setUserRestriction(ComponentName who, String key, boolean enabled) {
- final UserHandle userHandle = new UserHandle(UserHandle.getCallingUserId());
+ final UserHandle user = new UserHandle(UserHandle.getCallingUserId());
+ final int userHandle = user.getIdentifier();
synchronized (this) {
if (who == null) {
throw new NullPointerException("ComponentName is null");
@@ -4624,7 +4656,7 @@
if (!isDeviceOwner && DEVICE_OWNER_USER_RESTRICTIONS.contains(key)) {
throw new SecurityException("Profile owners cannot set user restriction " + key);
}
- boolean alreadyRestricted = mUserManager.hasUserRestriction(key, userHandle);
+ boolean alreadyRestricted = mUserManager.hasUserRestriction(key, user);
IAudioService iAudioService = null;
if (UserManager.DISALLOW_UNMUTE_MICROPHONE.equals(key)
@@ -4650,7 +4682,7 @@
if (UserManager.DISALLOW_CONFIG_WIFI.equals(key)) {
Settings.Secure.putIntForUser(mContext.getContentResolver(),
Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0,
- userHandle.getIdentifier());
+ userHandle);
} else if (UserManager.DISALLOW_USB_FILE_TRANSFER.equals(key)) {
UsbManager manager =
(UsbManager) mContext.getSystemService(Context.USB_SERVICE);
@@ -4658,27 +4690,30 @@
} else if (UserManager.DISALLOW_SHARE_LOCATION.equals(key)) {
Settings.Secure.putIntForUser(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF,
- userHandle.getIdentifier());
+ userHandle);
Settings.Secure.putStringForUser(mContext.getContentResolver(),
Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "",
- userHandle.getIdentifier());
+ userHandle);
} else if (UserManager.DISALLOW_DEBUGGING_FEATURES.equals(key)) {
- Settings.Global.putStringForUser(mContext.getContentResolver(),
- Settings.Global.ADB_ENABLED, "0", userHandle.getIdentifier());
+ // Only disable adb if changing for primary user, since it is global
+ if (userHandle == UserHandle.USER_OWNER) {
+ Settings.Global.putStringForUser(mContext.getContentResolver(),
+ Settings.Global.ADB_ENABLED, "0", userHandle);
+ }
} else if (UserManager.ENSURE_VERIFY_APPS.equals(key)) {
Settings.Global.putStringForUser(mContext.getContentResolver(),
Settings.Global.PACKAGE_VERIFIER_ENABLE, "1",
- userHandle.getIdentifier());
+ userHandle);
Settings.Global.putStringForUser(mContext.getContentResolver(),
Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, "1",
- userHandle.getIdentifier());
+ userHandle);
} else if (UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES.equals(key)) {
Settings.Secure.putIntForUser(mContext.getContentResolver(),
Settings.Secure.INSTALL_NON_MARKET_APPS, 0,
- userHandle.getIdentifier());
+ userHandle);
}
}
- mUserManager.setUserRestriction(key, enabled, userHandle);
+ mUserManager.setUserRestriction(key, enabled, user);
} finally {
restoreCallingIdentity(id);
}
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 2dcdcc4..92117c3 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -33,6 +33,7 @@
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.os.Binder;
+import android.os.Debug;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
diff --git a/telecomm/java/android/telecomm/Call.java b/telecomm/java/android/telecomm/Call.java
index c3aa2a0..7ada9b1 100644
--- a/telecomm/java/android/telecomm/Call.java
+++ b/telecomm/java/android/telecomm/Call.java
@@ -108,7 +108,7 @@
/**
* @return The presentation requirements for the handle. See
- * {@link PropertyPresentation} for valid values.
+ * {@link TelecommManager} for valid values.
*/
public int getHandlePresentation() {
return mHandlePresentation;
@@ -123,7 +123,7 @@
/**
* @return The presentation requirements for the caller display name. See
- * {@link PropertyPresentation} for valid values.
+ * {@link TelecommManager} for valid values.
*/
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
@@ -482,13 +482,6 @@
}
/**
- * Notifies this {@code Call} that the phone account user interface element was touched.
- */
- public void phoneAccountClicked() {
- mInCallAdapter.phoneAccountClicked(mTelecommCallId);
- }
-
- /**
* Notifies this {@code Call} that an account has been selected and to proceed with placing
* an outgoing call.
*/
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index 03db1c3..729686d 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -492,7 +492,8 @@
}
/**
- * @return The {@link PropertyPresentation} which controls how the handle is shown.
+ * @return The presentation requirements for the handle.
+ * See {@link TelecommManager} for valid values.
*/
public final int getHandlePresentation() {
return mHandlePresentation;
@@ -506,8 +507,8 @@
}
/**
- * @return The {@link PropertyPresentation} which controls how the caller display name is
- * shown.
+ * @return The presentation requirements for the handle.
+ * See {@link TelecommManager} for valid values.
*/
public final int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
@@ -624,7 +625,7 @@
final void setAudioState(AudioState state) {
Log.d(this, "setAudioState %s", state);
mAudioState = state;
- onSetAudioState(state);
+ onAudioStateChanged(state);
}
/**
@@ -664,8 +665,8 @@
* Sets the value of the {@link #getHandle()} property.
*
* @param handle The new handle.
- * @param presentation The {@link PropertyPresentation} which controls how the handle is
- * shown.
+ * @param presentation The presentation requirements for the handle.
+ * See {@link TelecommManager} for valid values.
*/
public final void setHandle(Uri handle, int presentation) {
Log.d(this, "setHandle %s", handle);
@@ -680,8 +681,8 @@
* Sets the caller display name (CNAP).
*
* @param callerDisplayName The new display name.
- * @param presentation The {@link PropertyPresentation} which controls how the name is
- * shown.
+ * @param presentation The presentation requirements for the handle.
+ * See {@link TelecommManager} for valid values.
*/
public final void setCallerDisplayName(String callerDisplayName, int presentation) {
Log.d(this, "setCallerDisplayName %s", callerDisplayName);
@@ -945,7 +946,7 @@
*
* @param state The new call audio state.
*/
- public void onSetAudioState(AudioState state) {}
+ public void onAudioStateChanged(AudioState state) {}
/**
* Notifies this Connection of an internal state change. This method is called after the
@@ -953,7 +954,7 @@
*
* @param state The new state, one of the {@code STATE_*} constants.
*/
- public void onSetState(int state) {}
+ public void onStateChanged(int state) {}
/**
* Notifies this Connection of a request to play a DTMF tone.
@@ -1021,11 +1022,6 @@
public void onPostDialContinue(boolean proceed) {}
/**
- * Called when the phone account UI was clicked.
- */
- public void onPhoneAccountClicked() {}
-
- /**
* Merge this connection and the specified connection into a conference call. Once the
* connections are merged, the calls should be added to the an existing or new
* {@code Conference} instance. For new {@code Conference} instances, use
@@ -1068,7 +1064,7 @@
if (mState != state) {
Log.d(this, "setState: %s", stateToString(state));
mState = state;
- onSetState(state);
+ onStateChanged(state);
for (Listener l : mListeners) {
l.onStateChanged(this, state);
}
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index 39365b6..76e208b 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -69,7 +69,6 @@
private static final int MSG_CONFERENCE = 12;
private static final int MSG_SPLIT_FROM_CONFERENCE = 13;
private static final int MSG_ON_POST_DIAL_CONTINUE = 14;
- private static final int MSG_ON_PHONE_ACCOUNT_CLICKED = 15;
private static final int MSG_REMOVE_CONNECTION_SERVICE_ADAPTER = 16;
private static final int MSG_ANSWER_VIDEO = 17;
private static final int MSG_MERGE_CONFERENCE = 18;
@@ -200,11 +199,6 @@
args.argi1 = proceed ? 1 : 0;
mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
}
-
- @Override
- public void onPhoneAccountClicked(String callId) {
- mHandler.obtainMessage(MSG_ON_PHONE_ACCOUNT_CLICKED, callId).sendToTarget();
- }
};
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -327,9 +321,6 @@
}
break;
}
- case MSG_ON_PHONE_ACCOUNT_CLICKED:
- onPhoneAccountHandleClicked((String) msg.obj);
- break;
default:
break;
}
@@ -678,11 +669,6 @@
findConnectionForAction(callId, "stopDtmfTone").onPostDialContinue(proceed);
}
- private void onPhoneAccountHandleClicked(String callId) {
- Log.d(this, "onPhoneAccountClicked %s", callId);
- findConnectionForAction(callId, "onPhoneAccountClicked").onPhoneAccountClicked();
- }
-
private void onAdapterAttached() {
if (mAreAccountsInitialized) {
// No need to query again if we already did it.
diff --git a/telecomm/java/android/telecomm/GatewayInfo.java b/telecomm/java/android/telecomm/GatewayInfo.java
index b95e6b6..a720284 100644
--- a/telecomm/java/android/telecomm/GatewayInfo.java
+++ b/telecomm/java/android/telecomm/GatewayInfo.java
@@ -16,6 +16,7 @@
package android.telecomm;
+import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
@@ -33,14 +34,15 @@
public class GatewayInfo implements Parcelable {
private final String mGatewayProviderPackageName;
- private final Uri mGatewayHandle;
- private final Uri mOriginalHandle;
+ private final Uri mGatewayAddress;
+ private final Uri mOriginalAddress;
/** @hide */
- public GatewayInfo(String packageName, Uri gatewayUri, Uri originalHandle) {
+ @SystemApi
+ public GatewayInfo(String packageName, Uri gatewayUri, Uri originalAddress) {
mGatewayProviderPackageName = packageName;
- mGatewayHandle = gatewayUri;
- mOriginalHandle = originalHandle;
+ mGatewayAddress = gatewayUri;
+ mOriginalAddress = originalAddress;
}
/**
@@ -51,21 +53,21 @@
}
/**
- * Gateway provider handle to use when actually placing the call.
+ * Gateway provider address to use when actually placing the call.
*/
- public Uri getGatewayHandle() {
- return mGatewayHandle;
+ public Uri getGatewayAddress() {
+ return mGatewayAddress;
}
/**
- * The actual call handle that the user is trying to connect to via the gateway.
+ * The actual call address that the user is trying to connect to via the gateway.
*/
- public Uri getOriginalHandle() {
- return mOriginalHandle;
+ public Uri getOriginalAddress() {
+ return mOriginalAddress;
}
public boolean isEmpty() {
- return TextUtils.isEmpty(mGatewayProviderPackageName) || mGatewayHandle == null;
+ return TextUtils.isEmpty(mGatewayProviderPackageName) || mGatewayAddress == null;
}
/** Implement the Parcelable interface */
@@ -76,8 +78,8 @@
public GatewayInfo createFromParcel(Parcel source) {
String gatewayPackageName = source.readString();
Uri gatewayUri = Uri.CREATOR.createFromParcel(source);
- Uri originalHandle = Uri.CREATOR.createFromParcel(source);
- return new GatewayInfo(gatewayPackageName, gatewayUri, originalHandle);
+ Uri originalAddress = Uri.CREATOR.createFromParcel(source);
+ return new GatewayInfo(gatewayPackageName, gatewayUri, originalAddress);
}
@Override
@@ -100,7 +102,7 @@
@Override
public void writeToParcel(Parcel destination, int flags) {
destination.writeString(mGatewayProviderPackageName);
- mGatewayHandle.writeToParcel(destination, 0);
- mOriginalHandle.writeToParcel(destination, 0);
+ mGatewayAddress.writeToParcel(destination, 0);
+ mOriginalAddress.writeToParcel(destination, 0);
}
}
diff --git a/telecomm/java/android/telecomm/InCallAdapter.java b/telecomm/java/android/telecomm/InCallAdapter.java
index 96ea5a6..899f35e 100644
--- a/telecomm/java/android/telecomm/InCallAdapter.java
+++ b/telecomm/java/android/telecomm/InCallAdapter.java
@@ -189,18 +189,6 @@
}
/**
- * Instructs Telecomm that the phone account UI was clicked.
- *
- * @param callId The identifier of the call.
- */
- public void phoneAccountClicked(String callId) {
- try {
- mAdapter.phoneAccountClicked(callId);
- } catch (RemoteException e) {
- }
- }
-
- /**
* Instructs Telecomm to add a PhoneAccountHandle to the specified call
*
* @param callId The identifier of the call
diff --git a/telecomm/java/android/telecomm/ParcelableCall.java b/telecomm/java/android/telecomm/ParcelableCall.java
index a2aa192..f7fc125 100644
--- a/telecomm/java/android/telecomm/ParcelableCall.java
+++ b/telecomm/java/android/telecomm/ParcelableCall.java
@@ -153,7 +153,9 @@
return mHandle;
}
- /** The {@link PropertyPresentation} which controls how the handle is shown. */
+ /**
+ * The presentation requirements for the handle. See {@link TelecommManager} for valid values.
+ */
public int getHandlePresentation() {
return mHandlePresentation;
}
@@ -163,7 +165,10 @@
return mCallerDisplayName;
}
- /** The {@link PropertyPresentation} which controls how the caller display name is shown. */
+ /**
+ * The presentation requirements for the caller display name.
+ * See {@link TelecommManager} for valid values.
+ */
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
}
diff --git a/telecomm/java/android/telecomm/PhoneAccount.java b/telecomm/java/android/telecomm/PhoneAccount.java
index f709a86..b37c144 100644
--- a/telecomm/java/android/telecomm/PhoneAccount.java
+++ b/telecomm/java/android/telecomm/PhoneAccount.java
@@ -83,6 +83,25 @@
public static final int CAPABILITY_VIDEO_CALLING = 0x8;
/**
+ * Flag indicating that this {@code PhoneAccount} is capable of placing emergency calls.
+ * By default all PSTN {@code PhoneAccount}s are capable of placing emergency calls.
+ * <p>
+ * See {@link #getCapabilities}
+ */
+ public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 0x10;
+
+ /**
+ * Flag indicating that this {@code PhoneAccount} is always enabled and cannot be disabled by
+ * the user.
+ * This capability is reserved for important {@code PhoneAccount}s such as the emergency calling
+ * only {@code PhoneAccount}.
+ * <p>
+ * See {@link #getCapabilities}
+ * @hide
+ */
+ public static final int CAPABILITY_ALWAYS_ENABLED = 0x20;
+
+ /**
* URI scheme for telephone number URIs.
*/
public static final String SCHEME_TEL = "tel";
@@ -105,6 +124,7 @@
private final CharSequence mLabel;
private final CharSequence mShortDescription;
private final List<String> mSupportedUriSchemes;
+ private final boolean mIsEnabled;
public static class Builder {
private PhoneAccountHandle mAccountHandle;
@@ -115,12 +135,31 @@
private CharSequence mLabel;
private CharSequence mShortDescription;
private List<String> mSupportedUriSchemes = new ArrayList<String>();
+ private boolean mIsEnabled = false;
public Builder(PhoneAccountHandle accountHandle, CharSequence label) {
this.mAccountHandle = accountHandle;
this.mLabel = label;
}
+ /**
+ * Creates an instance of the {@link PhoneAccount.Builder} from an existing
+ * {@link PhoneAccount}.
+ *
+ * @param phoneAccount The {@link PhoneAccount} used to initialize the builder.
+ */
+ public Builder(PhoneAccount phoneAccount) {
+ mAccountHandle = phoneAccount.getAccountHandle();
+ mAddress = phoneAccount.getAddress();
+ mSubscriptionAddress = phoneAccount.getSubscriptionAddress();
+ mCapabilities = phoneAccount.getCapabilities();
+ mIconResId = phoneAccount.getIconResId();
+ mLabel = phoneAccount.getLabel();
+ mShortDescription = phoneAccount.getShortDescription();
+ mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
+ mIsEnabled = phoneAccount.isEnabled();
+ }
+
public Builder setAddress(Uri value) {
this.mAddress = value;
return this;
@@ -177,6 +216,24 @@
return this;
}
+ /**
+ * Specifies whether the {@link PhoneAccount} is enabled or not. {@link PhoneAccount}s are
+ * by default not enabled.
+ *
+ * @param value {@code True} if the {@link PhoneAccount} is enabled.
+ * @return The Builder.
+ * @hide
+ */
+ public Builder setEnabled(boolean value) {
+ this.mIsEnabled = value;
+ return this;
+ }
+
+ /**
+ * Creates an instance of a {@link PhoneAccount} based on the current builder settings.
+ *
+ * @return The {@link PhoneAccount}.
+ */
public PhoneAccount build() {
// If no supported URI schemes were defined, assume "tel" is supported.
if (mSupportedUriSchemes.isEmpty()) {
@@ -191,7 +248,8 @@
mIconResId,
mLabel,
mShortDescription,
- mSupportedUriSchemes);
+ mSupportedUriSchemes,
+ mIsEnabled);
}
}
@@ -203,7 +261,8 @@
int iconResId,
CharSequence label,
CharSequence shortDescription,
- List<String> supportedUriSchemes) {
+ List<String> supportedUriSchemes,
+ boolean enabled) {
mAccountHandle = account;
mAddress = address;
mSubscriptionAddress = subscriptionAddress;
@@ -212,6 +271,7 @@
mLabel = label;
mShortDescription = shortDescription;
mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
+ mIsEnabled = enabled;
}
public static Builder builder(
@@ -221,6 +281,14 @@
}
/**
+ * Returns a builder initialized with the current {@link PhoneAccount} instance.
+ *
+ * @return The builder.
+ * @hide
+ */
+ public Builder toBuilder() { return new Builder(this); }
+
+ /**
* The unique identifier of this {@code PhoneAccount}.
*
* @return A {@code PhoneAccountHandle}.
@@ -265,6 +333,17 @@
}
/**
+ * Determines if this {@code PhoneAccount} has a capabilities specified by the passed in
+ * bit mask.
+ *
+ * @param capability The capabilities to check.
+ * @return {@code True} if the phone account has the capability.
+ */
+ public boolean hasCapabilities(int capability) {
+ return (mCapabilities & capability) == capability;
+ }
+
+ /**
* A short label describing a {@code PhoneAccount}.
*
* @return A label for this {@code PhoneAccount}.
@@ -313,6 +392,15 @@
}
/**
+ * Determines whether this {@code PhoneAccount} is enabled.
+ *
+ * @return {@code True} if this {@code PhoneAccount} is enabled..
+ */
+ public boolean isEnabled() {
+ return mIsEnabled;
+ }
+
+ /**
* The icon resource ID for the icon of this {@code PhoneAccount}.
*
* @return A resource ID.
@@ -367,6 +455,7 @@
out.writeCharSequence(mLabel);
out.writeCharSequence(mShortDescription);
out.writeList(mSupportedUriSchemes);
+ out.writeInt(mIsEnabled ? 1 : 0);
}
public static final Creator<PhoneAccount> CREATOR
@@ -396,5 +485,6 @@
List<String> supportedUriSchemes = new ArrayList<>();
in.readList(supportedUriSchemes, classLoader);
mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
+ mIsEnabled = in.readInt() == 1;
}
}
diff --git a/telecomm/java/android/telecomm/PropertyPresentation.java b/telecomm/java/android/telecomm/PropertyPresentation.java
deleted file mode 100644
index fe97b3d..0000000
--- a/telecomm/java/android/telecomm/PropertyPresentation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2014, 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 android.telecomm;
-
-/**
- * Defines how properties such as phone numbers and names are displayed to the user.
- */
-public class PropertyPresentation {
- /** Property is displayed normally. */
- public static final int ALLOWED = 1;
-
- /** Property was blocked. */
- public static final int RESTRICTED = 2;
-
- /** Presentation was not specified or is unknown. */
- public static final int UNKNOWN = 3;
-
- /** Property should be displayed as a pay phone. */
- public static final int PAYPHONE = 4;
-}
diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java
index 8ad8d19..68367f0 100644
--- a/telecomm/java/android/telecomm/RemoteConnection.java
+++ b/telecomm/java/android/telecomm/RemoteConnection.java
@@ -138,8 +138,8 @@
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param handle The new handle of the {@code RemoteConnection}.
- * @param presentation The {@link PropertyPresentation} which controls how the
- * handle is shown.
+ * @param presentation The presentation requirements for the handle.
+ * See {@link TelecommManager} for valid values.
*/
public void onHandleChanged(RemoteConnection connection, Uri handle, int presentation) {}
@@ -149,8 +149,8 @@
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param callerDisplayName The new caller display name of the {@code RemoteConnection}.
- * @param presentation The {@link PropertyPresentation} which controls how the
- * caller display name is shown.
+ * @param presentation The presentation requirements for the handle.
+ * See {@link TelecommManager} for valid values.
*/
public void onCallerDisplayNameChanged(
RemoteConnection connection, String callerDisplayName, int presentation) {}
@@ -544,7 +544,7 @@
/**
* @return The presentation requirements for the handle. See
- * {@link PropertyPresentation} for valid values.
+ * {@link TelecommManager} for valid values.
*/
public int getHandlePresentation() {
return mHandlePresentation;
@@ -559,7 +559,7 @@
/**
* @return The presentation requirements for the caller display name. See
- * {@link PropertyPresentation} for valid values.
+ * {@link TelecommManager} for valid values.
*/
public int getCallerDisplayNamePresentation() {
return mCallerDisplayNamePresentation;
diff --git a/telecomm/java/android/telecomm/Response.java b/telecomm/java/android/telecomm/Response.java
index f879756..ad78ebd 100644
--- a/telecomm/java/android/telecomm/Response.java
+++ b/telecomm/java/android/telecomm/Response.java
@@ -17,10 +17,7 @@
package android.telecomm;
/**
- * <strong>OBSOLETE</strong> Used to inform a client of asynchronously returned results.
- * <p>
- * <strong>TODO:</strong> Remove onCreateConferenceConnection() async method
- * then delete this interface.
+ * @hide
*/
public interface Response<IN, OUT> {
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java
index 5e9e6d0..a19f51b 100644
--- a/telecomm/java/android/telecomm/TelecommManager.java
+++ b/telecomm/java/android/telecomm/TelecommManager.java
@@ -25,6 +25,7 @@
import com.android.internal.telecomm.ITelecommService;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -141,6 +142,30 @@
"android.telecomm.extra.CONNECTION_SERVICE";
/**
+ * An optional {@link android.content.Intent#ACTION_CALL} intent extra denoting the
+ * package name of the app specifying an alternative gateway for the call.
+ * The value is a string.
+ *
+ * (The following comment corresponds to the all GATEWAY_* extras)
+ * An app which sends the {@link android.content.Intent#ACTION_CALL} intent can specify an
+ * alternative address to dial which is different from the one specified and displayed to
+ * the user. This alternative address is referred to as the gateway address.
+ */
+ public static final String GATEWAY_PROVIDER_PACKAGE =
+ "android.telecomm.extra.GATEWAY_PROVIDER_PACKAGE";
+
+ /**
+ * An optional {@link android.content.Intent#ACTION_CALL} intent extra corresponding to the
+ * original address to dial for the call. This is used when an alternative gateway address is
+ * provided to recall the original address.
+ * The value is a {@link android.net.Uri}.
+ *
+ * (See {@link #GATEWAY_PROVIDER_PACKAGE} for details)
+ */
+ public static final String GATEWAY_ORIGINAL_ADDRESS =
+ "android.telecomm.extra.GATEWAY_ORIGINAL_ADDRESS";
+
+ /**
* The number which the party on the other side of the line will see (and use to return the
* call).
* <p>
@@ -238,6 +263,23 @@
public static final String EXTRA_TTY_PREFERRED_MODE =
"android.telecomm.intent.extra.TTY_PREFERRED";
+ /**
+ * The following 4 constants define how properties such as phone numbers and names are
+ * displayed to the user.
+ */
+
+ /** Property is displayed normally. */
+ public static final int PRESENTATION_ALLOWED = 1;
+
+ /** Property was blocked. */
+ public static final int PRESENTATION_RESTRICTED = 2;
+
+ /** Presentation was not specified or is unknown. */
+ public static final int PRESENTATION_UNKNOWN = 3;
+
+ /** Property should be displayed as a pay phone. */
+ public static final int PRESENTATION_PAYPHONE = 4;
+
private static final String TAG = "TelecommManager";
private static final String TELECOMM_SERVICE_NAME = "telecomm";
@@ -270,7 +312,7 @@
* <p>
* Apps must be prepared for this method to return {@code null}, indicating that there currently
* exists no user-chosen default {@code PhoneAccount}. In this case, apps wishing to initiate a
- * phone call must either create their {@link android.content .Intent#ACTION_CALL} or
+ * phone call must either create their {@link android.content.Intent#ACTION_CALL} or
* {@link android.content.Intent#ACTION_DIAL} {@code Intent} with no
* {@link TelecommManager#EXTRA_PHONE_ACCOUNT_HANDLE}, or present the user with an affordance to
* select one of the elements of {@link #getEnabledPhoneAccounts()}.
@@ -330,8 +372,8 @@
}
/**
- * Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
- * calls.
+ * Return a list of enabled {@link PhoneAccountHandle}s which can be used to make and receive
+ * phone calls.
*
* @see #EXTRA_PHONE_ACCOUNT_HANDLE
* @return A list of {@code PhoneAccountHandle} objects.
@@ -339,10 +381,10 @@
public List<PhoneAccountHandle> getEnabledPhoneAccounts() {
try {
if (isServiceConnected()) {
- return getTelecommService().getOutgoingPhoneAccounts();
+ return getTelecommService().getEnabledPhoneAccounts();
}
} catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelecommService#getOutgoingPhoneAccounts", e);
+ Log.e(TAG, "Error calling ITelecommService#getEnabledPhoneAccounts", e);
}
return new ArrayList<>();
}
@@ -408,8 +450,8 @@
}
/**
- * Returns a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
- * calls which support the specified URI scheme.
+ * Returns a list of the enabled {@link PhoneAccountHandle}s which can be used to make and
+ * receive phone calls which support the specified URI scheme.
* <P>
* For example, invoking with {@code "tel"} will find all {@link PhoneAccountHandle}s which
* support telephone calls (e.g. URIs such as {@code tel:555-555-1212}). Invoking with
@@ -459,6 +501,78 @@
}
/**
+ * Returns a count of enabled and disabled {@link PhoneAccount}s.
+ *
+ * @return The count of enabled and disabled {@link PhoneAccount}s.
+ * @hide
+ */
+ @SystemApi
+ public int getAllPhoneAccountsCount() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecommService().getAllPhoneAccountsCount();
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecommService#getAllPhoneAccountsCount", e);
+ }
+ return 0;
+ }
+
+ /**
+ * Returns a list of all {@link PhoneAccount}s.
+ *
+ * @return All {@link PhoneAccount}s.
+ * @hide
+ */
+ @SystemApi
+ public List<PhoneAccount> getAllPhoneAccounts() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecommService().getAllPhoneAccounts();
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecommService#getAllPhoneAccounts", e);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * Returns a list of all {@link PhoneAccountHandle}s.
+ *
+ * @return All {@link PhoneAccountHandle}s.
+ * @hide
+ */
+ @SystemApi
+ public List<PhoneAccountHandle> getAllPhoneAccountHandles() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecommService().getAllPhoneAccountHandles();
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecommService#getAllPhoneAccountHandles", e);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * Enables or disables a {@link PhoneAccount}.
+ *
+ * @param account The {@link PhoneAccountHandle} to enable or disable.
+ * @param isEnabled {@code True} if the phone account should be enabled.
+ * @hide
+ */
+ @SystemApi
+ public void setPhoneAccountEnabled(PhoneAccountHandle account, boolean isEnabled) {
+ try {
+ if (isServiceConnected()) {
+ getTelecommService().setPhoneAccountEnabled(account, isEnabled);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelecommService#setPhoneAccountEnabled", e);
+ }
+ }
+
+ /**
* Register a {@link PhoneAccount} for use by the system.
*
* @param account The complete {@link PhoneAccount}.
@@ -489,15 +603,13 @@
}
/**
- * Remove all Accounts for a given package from the system.
- *
- * @param packageName A package name that may have registered Accounts.
+ * Remove all Accounts that belong to the calling package from the system.
*/
@SystemApi
- public void clearAccounts(String packageName) {
+ public void clearAccounts() {
try {
if (isServiceConnected()) {
- getTelecommService().clearAccounts(packageName);
+ getTelecommService().clearAccounts(mContext.getPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecommService#clearAccounts", e);
diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl
index a673733..3af4ed3 100644
--- a/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl
@@ -70,6 +70,4 @@
void swapConference(String conferenceCallId);
void onPostDialContinue(String callId, boolean proceed);
-
- void onPhoneAccountClicked(String callId);
}
diff --git a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl
index 626bb91..808a410 100644
--- a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl
@@ -46,8 +46,6 @@
void postDialContinue(String callId, boolean proceed);
- void phoneAccountClicked(String callId);
-
void phoneAccountSelected(String callId, in PhoneAccountHandle accountHandle);
void conference(String callId, String otherCallId);
diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
index 6ab78c4..30f2801 100644
--- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
@@ -50,9 +50,9 @@
void setUserSelectedOutgoingPhoneAccount(in PhoneAccountHandle account);
/**
- * @see TelecommServiceImpl#getOutgoingPhoneAccounts
+ * @see TelecommServiceImpl#getEnabledPhoneAccounts
*/
- List<PhoneAccountHandle> getOutgoingPhoneAccounts();
+ List<PhoneAccountHandle> getEnabledPhoneAccounts();
/**
* @see TelecommManager#getPhoneAccountsSupportingScheme
@@ -65,6 +65,21 @@
PhoneAccount getPhoneAccount(in PhoneAccountHandle account);
/**
+ * @see TelecommManager#getAllPhoneAccountsCount
+ */
+ int getAllPhoneAccountsCount();
+
+ /**
+ * @see TelecommManager#getAllPhoneAccounts
+ */
+ List<PhoneAccount> getAllPhoneAccounts();
+
+ /**
+ * @see TelecommManager#getAllPhoneAccountHandles
+ */
+ List<PhoneAccountHandle> getAllPhoneAccountHandles();
+
+ /**
* @see TelecommServiceImpl#getSimCallManager
*/
PhoneAccountHandle getSimCallManager();
@@ -80,6 +95,11 @@
List<PhoneAccountHandle> getSimCallManagers();
/**
+ * @see TelecommServiceImpl#setPhoneAccountEnabled
+ */
+ void setPhoneAccountEnabled(in PhoneAccountHandle account, in boolean isEnabled);
+
+ /**
* @see TelecommServiceImpl#registerPhoneAccount
*/
void registerPhoneAccount(in PhoneAccount metadata);
diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
index a68e04e..9df11fe 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
@@ -29,6 +29,7 @@
import android.os.RemoteException;
import android.util.Log;
import android.util.SparseArray;
+import android.widget.Toast;
import com.android.demo.jobSchedulerApp.MainActivity;
@@ -84,12 +85,15 @@
currentId++;
jobParamsMap.put(currentId, params);
final int currId = this.currentId;
- Log.d(TAG, "putting :" + currId + " for " + params.toString());
- Log.d(TAG, " pulled: " + jobParamsMap.get(currId));
if (mActivity != null) {
mActivity.onReceivedStartJob(params);
}
+ Toast.makeText(
+ this, "On start job: '" + params.getJobId() + "' deadline exceeded: " +
+ params.isOverrideDeadlineExpired(),
+ Toast.LENGTH_LONG).show();
+
return true;
}
@@ -100,7 +104,7 @@
int ind = jobParamsMap.indexOfValue(params);
jobParamsMap.remove(ind);
mActivity.onReceivedStopJob();
- return true;
+ return false; // no reschedule
}
static int currentId = 0;
@@ -129,6 +133,7 @@
return false;
} else {
jobFinished(params, false);
+ jobParamsMap.removeAt(0);
return true;
}
}
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 27e60f3..41d8502 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -2390,7 +2390,8 @@
char* packageString = strtok(libs.lockBuffer(libs.length()), ":");
while (packageString != NULL) {
// Write the R.java file out with the correct package name
- err = writeResourceSymbols(bundle, assets, String8(packageString), true, false);
+ err = writeResourceSymbols(bundle, assets, String8(packageString), true,
+ bundle->getBuildSharedLibrary());
if (err < 0) {
goto bail;
}
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 5deeca2..afec5ed 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1926,110 +1926,75 @@
return String16();
}
-static void writeResourceLoadedCallback(FILE* fp, int indent) {
- IndentPrinter p(fp, 4);
- p.indent(indent);
- p.println("private static void rewriteIntArrayField(java.lang.reflect.Field field, int packageId) throws IllegalAccessException {");
- {
- p.indent();
- p.println("int requiredModifiers = java.lang.reflect.Modifier.STATIC | java.lang.reflect.Modifier.PUBLIC;");
- p.println("if ((field.getModifiers() & requiredModifiers) != requiredModifiers) {");
- {
- p.indent();
- p.println("throw new IllegalArgumentException(\"Field \" + field.getName() + \" is not rewritable\");");
- p.indent(-1);
- }
- p.println("}");
- p.println("if (field.getType() != int[].class) {");
- {
- p.indent();
- p.println("throw new IllegalArgumentException(\"Field \" + field.getName() + \" is not an int array\");");
- p.indent(-1);
- }
- p.println("}");
- p.println("int[] array = (int[]) field.get(null);");
- p.println("for (int i = 0; i < array.length; i++) {");
- {
- p.indent();
- p.println("array[i] = (array[i] & 0x00ffffff) | (packageId << 24);");
- p.indent(-1);
- }
- p.println("}");
- p.indent(-1);
+static status_t writeResourceLoadedCallbackForLayoutClasses(
+ FILE* fp, const sp<AaptAssets>& assets,
+ const sp<AaptSymbols>& symbols, int indent, bool includePrivate)
+{
+ String16 attr16("attr");
+ String16 package16(assets->getPackage());
+
+ const char* indentStr = getIndentSpace(indent);
+ bool hasErrors = false;
+
+ size_t i;
+ size_t N = symbols->getNestedSymbols().size();
+ for (i=0; i<N; i++) {
+ sp<AaptSymbols> nsymbols = symbols->getNestedSymbols().valueAt(i);
+ String8 realClassName(symbols->getNestedSymbols().keyAt(i));
+ String8 nclassName(flattenSymbol(realClassName));
+
+ fprintf(fp,
+ "%sfor(int i = 0; i < styleable.%s.length; ++i) {\n"
+ "%sstyleable.%s[i] = (styleable.%s[i] & 0x00ffffff) | (packageId << 24);\n"
+ "%s}\n",
+ indentStr, nclassName.string(),
+ getIndentSpace(indent+1), nclassName.string(), nclassName.string(),
+ indentStr);
}
- p.println("}");
- p.println();
- p.println("private static void rewriteIntField(java.lang.reflect.Field field, int packageId) throws IllegalAccessException {");
- {
- p.indent();
- p.println("int requiredModifiers = java.lang.reflect.Modifier.STATIC | java.lang.reflect.Modifier.PUBLIC;");
- p.println("int bannedModifiers = java.lang.reflect.Modifier.FINAL;");
- p.println("int mod = field.getModifiers();");
- p.println("if ((mod & requiredModifiers) != requiredModifiers || (mod & bannedModifiers) != 0) {");
- {
- p.indent();
- p.println("throw new IllegalArgumentException(\"Field \" + field.getName() + \" is not rewritable\");");
- p.indent(-1);
+
+ return hasErrors ? UNKNOWN_ERROR : NO_ERROR;
+}
+
+static status_t writeResourceLoadedCallback(
+ FILE* fp, const sp<AaptAssets>& assets, bool includePrivate,
+ const sp<AaptSymbols>& symbols, const String8& className, int indent)
+{
+ size_t i;
+ status_t err = NO_ERROR;
+
+ size_t N = symbols->getSymbols().size();
+ for (i=0; i<N; i++) {
+ const AaptSymbolEntry& sym = symbols->getSymbols().valueAt(i);
+ if (sym.typeCode == AaptSymbolEntry::TYPE_UNKNOWN) {
+ continue;
}
- p.println("}");
- p.println("if (field.getType() != int.class && field.getType() != Integer.class) {");
- {
- p.indent();
- p.println("throw new IllegalArgumentException(\"Field \" + field.getName() + \" is not an int\");");
- p.indent(-1);
+ if (!assets->isJavaSymbol(sym, includePrivate)) {
+ continue;
}
- p.println("}");
- p.println("int resId = field.getInt(null);");
- p.println("field.setInt(null, (resId & 0x00ffffff) | (packageId << 24));");
- p.indent(-1);
+ String8 flat_name(flattenSymbol(sym.name));
+ fprintf(fp,
+ "%s%s.%s = (%s.%s & 0x00ffffff) | (packageId << 24);\n",
+ getIndentSpace(indent), className.string(), flat_name.string(),
+ className.string(), flat_name.string());
}
- p.println("}");
- p.println();
- p.println("public static void onResourcesLoaded(int assignedPackageId) throws Exception {");
- {
- p.indent();
- p.println("Class<?>[] declaredClasses = R.class.getDeclaredClasses();");
- p.println("for (Class<?> clazz : declaredClasses) {");
- {
- p.indent();
- p.println("if (clazz.getSimpleName().equals(\"styleable\")) {");
- {
- p.indent();
- p.println("for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {");
- {
- p.indent();
- p.println("if (field.getType() == int[].class) {");
- {
- p.indent();
- p.println("rewriteIntArrayField(field, assignedPackageId);");
- p.indent(-1);
- }
- p.println("}");
- p.indent(-1);
- }
- p.println("}");
- p.indent(-1);
- }
- p.println("} else {");
- {
- p.indent();
- p.println("for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {");
- {
- p.indent();
- p.println("rewriteIntField(field, assignedPackageId);");
- p.indent(-1);
- }
- p.println("}");
- p.indent(-1);
- }
- p.println("}");
- p.indent(-1);
+
+ N = symbols->getNestedSymbols().size();
+ for (i=0; i<N; i++) {
+ sp<AaptSymbols> nsymbols = symbols->getNestedSymbols().valueAt(i);
+ String8 nclassName(symbols->getNestedSymbols().keyAt(i));
+ if (nclassName == "styleable") {
+ err = writeResourceLoadedCallbackForLayoutClasses(
+ fp, assets, nsymbols, indent, includePrivate);
+ } else {
+ err = writeResourceLoadedCallback(fp, assets, includePrivate, nsymbols,
+ nclassName, indent);
}
- p.println("}");
- p.indent(-1);
+ if (err != NO_ERROR) {
+ return err;
+ }
}
- p.println("}");
- p.println();
+
+ return NO_ERROR;
}
static status_t writeLayoutClasses(
@@ -2485,7 +2450,10 @@
}
if (emitCallback) {
- writeResourceLoadedCallback(fp, indent);
+ fprintf(fp, "%spublic static void onResourcesLoaded(int packageId) {\n",
+ getIndentSpace(indent));
+ writeResourceLoadedCallback(fp, assets, includePrivate, symbols, className, indent + 1);
+ fprintf(fp, "%s}\n", getIndentSpace(indent));
}
indent--;