Skip to content

Commit

Permalink
Merge remote-tracking branch 'AOSP/lollipop-mr1-release' into lollipo…
Browse files Browse the repository at this point in the history
…p-ras-mr1
  • Loading branch information
rascarlo committed Aug 6, 2015
2 parents 9e5529c + a5e904e commit d4b3fa4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 24 deletions.
6 changes: 3 additions & 3 deletions core/java/android/appwidget/AppWidgetHost.java
Expand Up @@ -221,10 +221,10 @@ public final void startAppWidgetConfigureActivityForResult(@NonNull Activity act
int appWidgetId, int intentFlags, int requestCode, @Nullable Bundle options) {
try {
IntentSender intentSender = sService.createAppWidgetConfigIntentSender(
mContextOpPackageName, appWidgetId, intentFlags);
mContextOpPackageName, appWidgetId);
if (intentSender != null) {
activity.startIntentSenderForResult(intentSender, requestCode, null, 0, 0, 0,
options);
activity.startIntentSenderForResult(intentSender, requestCode, null, 0,
intentFlags, intentFlags, options);
} else {
throw new ActivityNotFoundException();
}
Expand Down
Expand Up @@ -41,8 +41,7 @@ interface IAppWidgetService {
void deleteAllHosts();
RemoteViews getAppWidgetViews(String callingPackage, int appWidgetId);
int[] getAppWidgetIdsForHost(String callingPackage, int hostId);
IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId,
int intentFlags);
IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId);

//
// for AppWidgetManager
Expand Down
22 changes: 15 additions & 7 deletions core/jni/android/graphics/Bitmap.cpp
Expand Up @@ -575,24 +575,33 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
return NULL;
}

SkBitmap* bitmap = new SkBitmap;
SkAutoTDelete<SkBitmap> bitmap(new SkBitmap);

bitmap->setInfo(SkImageInfo::Make(width, height, colorType, alphaType), rowBytes);
if (!bitmap->setInfo(SkImageInfo::Make(width, height, colorType, alphaType), rowBytes)) {
return NULL;
}

SkColorTable* ctable = NULL;
if (colorType == kIndex_8_SkColorType) {
int count = p->readInt32();
if (count < 0 || count > 256) {
// The data is corrupt, since SkColorTable enforces a value between 0 and 256,
// inclusive.
return NULL;
}
if (count > 0) {
size_t size = count * sizeof(SkPMColor);
const SkPMColor* src = (const SkPMColor*)p->readInplace(size);
if (src == NULL) {
return NULL;
}
ctable = new SkColorTable(src, count);
}
}

jbyteArray buffer = GraphicsJNI::allocateJavaPixelRef(env, bitmap, ctable);
jbyteArray buffer = GraphicsJNI::allocateJavaPixelRef(env, bitmap.get(), ctable);
if (NULL == buffer) {
SkSafeUnref(ctable);
delete bitmap;
return NULL;
}

Expand All @@ -604,7 +613,6 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
android::status_t status = p->readBlob(size, &blob);
if (status) {
doThrowRE(env, "Could not read bitmap from parcel blob.");
delete bitmap;
return NULL;
}

Expand All @@ -614,8 +622,8 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {

blob.release();

return GraphicsJNI::createBitmap(env, bitmap, buffer, getPremulBitmapCreateFlags(isMutable),
NULL, NULL, density);
return GraphicsJNI::createBitmap(env, bitmap.detach(), buffer,
getPremulBitmapCreateFlags(isMutable), NULL, NULL, density);
}

static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
Expand Down
5 changes: 5 additions & 0 deletions core/res/AndroidManifest.xml
Expand Up @@ -1333,6 +1333,11 @@
android:description="@string/permdesc_control_incall_experience"
android:label="@string/permlab_control_incall_experience" />

<!-- Allows an application to receive STK related commands.
@hide -->
<permission android:name="android.permission.RECEIVE_STK_COMMANDS"
android:protectionLevel="system|signature" />

<!-- ================================== -->
<!-- Permissions for sdcard interaction -->
<!-- ================================== -->
Expand Down
Expand Up @@ -673,8 +673,7 @@ public void setBindAppWidgetPermission(String packageName, int grantId,
}

@Override
public IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId,
int intentFlags) {
public IntentSender createAppWidgetConfigIntentSender(String callingPackage, int appWidgetId) {
final int userId = UserHandle.getCallingUserId();

if (DEBUG) {
Expand Down Expand Up @@ -704,7 +703,6 @@ public IntentSender createAppWidgetConfigIntentSender(String callingPackage, int
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setComponent(provider.info.configure);
intent.setFlags(intentFlags);

// All right, create the sender.
final long identity = Binder.clearCallingIdentity();
Expand Down
Expand Up @@ -2691,9 +2691,14 @@ final ProcessRecord getProcessRecordLocked(String processName, int uid, boolean
// should never happen).
SparseArray<ProcessRecord> procs = mProcessNames.getMap().get(processName);
if (procs == null) return null;
final int N = procs.size();
for (int i = 0; i < N; i++) {
if (UserHandle.isSameUser(procs.keyAt(i), uid)) return procs.valueAt(i);
final int procCount = procs.size();
for (int i = 0; i < procCount; i++) {
final int procUid = procs.keyAt(i);
if (UserHandle.isApp(procUid) || !UserHandle.isSameUser(procUid, uid)) {
// Don't use an app process or different user process for system component.
continue;
}
return procs.valueAt(i);
}
}
ProcessRecord proc = mProcessNames.get(processName, uid);
Expand Down Expand Up @@ -8122,7 +8127,7 @@ private boolean isGetTasksAllowed(String caller, int callingPid, int callingUid)
}
if (!allowed) {
Slog.w(TAG, caller + ": caller " + callingUid
+ " does not hold GET_TASKS; limiting output");
+ " does not hold REAL_GET_TASKS; limiting output");
}
return allowed;
}
Expand Down Expand Up @@ -12241,16 +12246,23 @@ private void fillInProcMemInfo(ProcessRecord app,

public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() {
enforceNotIsolatedCaller("getRunningAppProcesses");

final int callingUid = Binder.getCallingUid();

// Lazy instantiation of list
List<ActivityManager.RunningAppProcessInfo> runList = null;
final boolean allUsers = ActivityManager.checkUidPermission(INTERACT_ACROSS_USERS_FULL,
Binder.getCallingUid()) == PackageManager.PERMISSION_GRANTED;
int userId = UserHandle.getUserId(Binder.getCallingUid());
callingUid) == PackageManager.PERMISSION_GRANTED;
final int userId = UserHandle.getUserId(callingUid);
final boolean allUids = isGetTasksAllowed(
"getRunningAppProcesses", Binder.getCallingPid(), callingUid);

synchronized (this) {
// Iterate across all processes
for (int i=mLruProcesses.size()-1; i>=0; i--) {
for (int i = mLruProcesses.size() - 1; i >= 0; i--) {
ProcessRecord app = mLruProcesses.get(i);
if (!allUsers && app.userId != userId) {
if ((!allUsers && app.userId != userId)
|| (!allUids && app.uid != callingUid)) {
continue;
}
if ((app.thread != null) && (!app.crashing && !app.notResponding)) {
Expand All @@ -12274,7 +12286,7 @@ public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() {
//Slog.v(TAG, "Proc " + app.processName + ": imp=" + currApp.importance
// + " lru=" + currApp.lru);
if (runList == null) {
runList = new ArrayList<ActivityManager.RunningAppProcessInfo>();
runList = new ArrayList<>();
}
runList.add(currApp);
}
Expand Down

0 comments on commit d4b3fa4

Please sign in to comment.