Unverified Commit 23a9ff60 authored by Kevin F. Haggerty's avatar Kevin F. Haggerty

Merge tag 'android-8.1.0_r47' into staging/lineage-15.1_merge-android-8.1.0_r47

Android 8.1.0 release 47

* tag 'android-8.1.0_r47':
  Revert "RESTRICT AUTOMERGE: Revoke permissions defined in a to-be removed package."
  Fix crash during cursor moving on BiDi text
  RESTRICT AUTOMERGE: Revoke permissions defined in a to-be removed package.
  DO NOT MERGE. Extend SQLiteQueryBuilder for update and delete.
  DO NOT MERGE. Execute "strict" queries with extra parentheses.
  DO NOT MERGE. Persistable Uri grants still require permissions.
  Optimise the hit test algorithm

Change-Id: I5a266009dbb7a5d0da9811c5b129138af2b4cce0
parents 293dde19 0b434bf5
......@@ -1732,7 +1732,8 @@ public final class SQLiteDatabase extends SQLiteClosable {
executeSql(sql, bindArgs);
}
private int executeSql(String sql, Object[] bindArgs) throws SQLException {
/** {@hide} */
public int executeSql(String sql, Object[] bindArgs) throws SQLException {
acquireReference();
try {
if (DatabaseUtils.getSqlStatementType(sql) == DatabaseUtils.STATEMENT_ATTACH) {
......
This diff is collapsed.
......@@ -368,6 +368,98 @@ class TextLine {
return h;
}
/**
* @see #measure(int, boolean, FontMetricsInt)
* @return The measure results for all possible offsets
*/
float[] measureAllOffsets(boolean[] trailing, FontMetricsInt fmi) {
float[] measurement = new float[mLen + 1];
int[] target = new int[mLen + 1];
for (int offset = 0; offset < target.length; ++offset) {
target[offset] = trailing[offset] ? offset - 1 : offset;
}
if (target[0] < 0) {
measurement[0] = 0;
}
float h = 0;
if (!mHasTabs) {
if (mDirections == Layout.DIRS_ALL_LEFT_TO_RIGHT) {
for (int offset = 0; offset <= mLen; ++offset) {
measurement[offset] = measureRun(0, offset, mLen, false, fmi);
}
return measurement;
}
if (mDirections == Layout.DIRS_ALL_RIGHT_TO_LEFT) {
for (int offset = 0; offset <= mLen; ++offset) {
measurement[offset] = measureRun(0, offset, mLen, true, fmi);
}
return measurement;
}
}
char[] chars = mChars;
int[] runs = mDirections.mDirections;
for (int i = 0; i < runs.length; i += 2) {
int runStart = runs[i];
int runLimit = runStart + (runs[i + 1] & Layout.RUN_LENGTH_MASK);
if (runLimit > mLen) {
runLimit = mLen;
}
boolean runIsRtl = (runs[i + 1] & Layout.RUN_RTL_FLAG) != 0;
int segstart = runStart;
for (int j = mHasTabs ? runStart : runLimit; j <= runLimit; ++j) {
int codept = 0;
if (mHasTabs && j < runLimit) {
codept = chars[j];
if (codept >= 0xD800 && codept < 0xDC00 && j + 1 < runLimit) {
codept = Character.codePointAt(chars, j);
if (codept > 0xFFFF) {
++j;
continue;
}
}
}
if (j == runLimit || codept == '\t') {
float oldh = h;
boolean advance = (mDir == Layout.DIR_RIGHT_TO_LEFT) == runIsRtl;
float w = measureRun(segstart, j, j, runIsRtl, fmi);
h += advance ? w : -w;
float baseh = advance ? oldh : h;
FontMetricsInt crtfmi = advance ? fmi : null;
for (int offset = segstart; offset <= j && offset <= mLen; ++offset) {
if (target[offset] >= segstart && target[offset] < j) {
measurement[offset] =
baseh + measureRun(segstart, offset, j, runIsRtl, crtfmi);
}
}
if (codept == '\t') {
if (target[j] == j) {
measurement[j] = h;
}
h = mDir * nextTab(h * mDir);
if (target[j + 1] == j) {
measurement[j + 1] = h;
}
}
segstart = j + 1;
}
}
}
if (target[mLen] == mLen) {
measurement[mLen] = h;
}
return measurement;
}
/**
* Draws a unidirectional (but possibly multi-styled) run of text.
*
......
......@@ -8911,10 +8911,17 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
// If we're extending a persistable grant, then we always need to create
// the grant data structure so that take/release APIs work
// Figure out the value returned when access is allowed
final int allowedResult;
if ((modeFlags & Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION) != 0) {
return targetUid;
// If we're extending a persistable grant, then we need to return
// "targetUid" so that we always create a grant data structure to
// support take/release APIs
allowedResult = targetUid;
} else {
// Otherwise, we can return "-1" to indicate that no grant data
// structures need to be created
allowedResult = -1;
}
if (targetUid >= 0) {
......@@ -8923,7 +8930,7 @@ public class ActivityManagerService extends IActivityManager.Stub
// No need to grant the target this permission.
if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Target " + targetPkg + " already has full permission to " + grantUri);
return -1;
return allowedResult;
}
} else {
// First... there is no target package, so can anyone access it?
......@@ -8939,7 +8946,7 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
if (allowed) {
return -1;
return allowedResult;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment