Commit 21d1abf4 authored by /e/ robot's avatar /e/ robot

Merge remote-tracking branch 'origin/lineage-15.1' into v1-oreo

parents ebfd0888 1bbe2b78
......@@ -127,6 +127,9 @@ public class DownloadManager {
*/
public final static String COLUMN_STATUS = Downloads.Impl.COLUMN_STATUS;
/** {@hide} */
public static final String COLUMN_FILE_NAME_HINT = Downloads.Impl.COLUMN_FILE_NAME_HINT;
/**
* Provides more detail on the status of the download. Its meaning depends on the value of
* {@link #COLUMN_STATUS}.
......@@ -164,6 +167,9 @@ public class DownloadManager {
*/
public static final String COLUMN_MEDIAPROVIDER_URI = Downloads.Impl.COLUMN_MEDIAPROVIDER_URI;
/** {@hide} */
public static final String COLUMN_DESTINATION = Downloads.Impl.COLUMN_DESTINATION;
/**
* @hide
*/
......@@ -337,26 +343,22 @@ public class DownloadManager {
* @hide
*/
public static final String[] UNDERLYING_COLUMNS = new String[] {
Downloads.Impl._ID,
Downloads.Impl._DATA + " AS " + COLUMN_LOCAL_FILENAME,
Downloads.Impl.COLUMN_MEDIAPROVIDER_URI,
Downloads.Impl.COLUMN_DESTINATION,
Downloads.Impl.COLUMN_TITLE,
Downloads.Impl.COLUMN_DESCRIPTION,
Downloads.Impl.COLUMN_URI,
Downloads.Impl.COLUMN_STATUS,
Downloads.Impl.COLUMN_FILE_NAME_HINT,
Downloads.Impl.COLUMN_MIME_TYPE + " AS " + COLUMN_MEDIA_TYPE,
Downloads.Impl.COLUMN_TOTAL_BYTES + " AS " + COLUMN_TOTAL_SIZE_BYTES,
Downloads.Impl.COLUMN_LAST_MODIFICATION + " AS " + COLUMN_LAST_MODIFIED_TIMESTAMP,
Downloads.Impl.COLUMN_CURRENT_BYTES + " AS " + COLUMN_BYTES_DOWNLOADED_SO_FAR,
Downloads.Impl.COLUMN_ALLOW_WRITE,
/* add the following 'computed' columns to the cursor.
* they are not 'returned' by the database, but their inclusion
* eliminates need to have lot of methods in CursorTranslator
*/
"'placeholder' AS " + COLUMN_LOCAL_URI,
"'placeholder' AS " + COLUMN_REASON
DownloadManager.COLUMN_ID,
DownloadManager.COLUMN_LOCAL_FILENAME,
DownloadManager.COLUMN_MEDIAPROVIDER_URI,
DownloadManager.COLUMN_DESTINATION,
DownloadManager.COLUMN_TITLE,
DownloadManager.COLUMN_DESCRIPTION,
DownloadManager.COLUMN_URI,
DownloadManager.COLUMN_STATUS,
DownloadManager.COLUMN_FILE_NAME_HINT,
DownloadManager.COLUMN_MEDIA_TYPE,
DownloadManager.COLUMN_TOTAL_SIZE_BYTES,
DownloadManager.COLUMN_LAST_MODIFIED_TIMESTAMP,
DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR,
DownloadManager.COLUMN_ALLOW_WRITE,
DownloadManager.COLUMN_LOCAL_URI,
DownloadManager.COLUMN_REASON
};
/**
......
This diff is collapsed.
......@@ -5308,6 +5308,18 @@ public final class Settings {
@Deprecated
public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
/**
* Indicates whether a DPC has been downloaded during provisioning.
*
* <p>Type: int (0 for false, 1 for true)
*
* <p>If this is true, then any attempts to begin setup again should result in factory reset
*
* @hide
*/
public static final String MANAGED_PROVISIONING_DPC_DOWNLOADED =
"managed_provisioning_dpc_downloaded";
/**
* Whether the current user has been set up via setup wizard (0 = false, 1 = true)
* @hide
......
/*
* Copyright (C) 2019 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.database.sqlite;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class SQLiteTokenizerTest {
private List<String> getTokens(String sql) {
return SQLiteTokenizer.tokenize(sql, SQLiteTokenizer.OPTION_NONE);
}
private void checkTokens(String sql, String spaceSeparatedExpectedTokens) {
final List<String> expected = spaceSeparatedExpectedTokens == null
? new ArrayList<>()
: Arrays.asList(spaceSeparatedExpectedTokens.split(" +"));
assertEquals(expected, getTokens(sql));
}
private void assertInvalidSql(String sql, String message) {
try {
getTokens(sql);
fail("Didn't throw InvalidSqlException");
} catch (IllegalArgumentException e) {
assertTrue("Expected " + e.getMessage() + " to contain " + message,
e.getMessage().contains(message));
}
}
@Test
public void testWhitespaces() {
checkTokens(" select \t\r\n a\n\n ", "select a");
checkTokens("a b", "a b");
}
@Test
public void testComment() {
checkTokens("--\n", null);
checkTokens("a--\n", "a");
checkTokens("a--abcdef\n", "a");
checkTokens("a--abcdef\nx", "a x");
checkTokens("a--\nx", "a x");
assertInvalidSql("a--abcdef", "Unterminated comment");
assertInvalidSql("a--abcdef\ndef--", "Unterminated comment");
checkTokens("/**/", null);
assertInvalidSql("/*", "Unterminated comment");
assertInvalidSql("/*/", "Unterminated comment");
assertInvalidSql("/*\n* /*a", "Unterminated comment");
checkTokens("a/**/", "a");
checkTokens("/**/b", "b");
checkTokens("a/**/b", "a b");
checkTokens("a/* -- \n* /* **/b", "a b");
}
@Test
public void testStrings() {
assertInvalidSql("'", "Unterminated quote");
assertInvalidSql("a'", "Unterminated quote");
assertInvalidSql("a'''", "Unterminated quote");
assertInvalidSql("a''' ", "Unterminated quote");
checkTokens("''", null);
checkTokens("''''", null);
checkTokens("a''''b", "a b");
checkTokens("a' '' 'b", "a b");
checkTokens("'abc'", null);
checkTokens("'abc\ndef'", null);
checkTokens("a'abc\ndef'", "a");
checkTokens("'abc\ndef'b", "b");
checkTokens("a'abc\ndef'b", "a b");
checkTokens("a'''abc\nd''ef'''b", "a b");
}
@Test
public void testDoubleQuotes() {
assertInvalidSql("\"", "Unterminated quote");
assertInvalidSql("a\"", "Unterminated quote");
assertInvalidSql("a\"\"\"", "Unterminated quote");
assertInvalidSql("a\"\"\" ", "Unterminated quote");
checkTokens("\"\"", "");
checkTokens("\"\"\"\"", "\"");
checkTokens("a\"\"\"\"b", "a \" b");
checkTokens("a\"\t\"\"\t\"b", "a \t\"\t b");
checkTokens("\"abc\"", "abc");
checkTokens("\"abc\ndef\"", "abc\ndef");
checkTokens("a\"abc\ndef\"", "a abc\ndef");
checkTokens("\"abc\ndef\"b", "abc\ndef b");
checkTokens("a\"abc\ndef\"b", "a abc\ndef b");
checkTokens("a\"\"\"abc\nd\"\"ef\"\"\"b", "a \"abc\nd\"ef\" b");
}
@Test
public void testBackQuotes() {
assertInvalidSql("`", "Unterminated quote");
assertInvalidSql("a`", "Unterminated quote");
assertInvalidSql("a```", "Unterminated quote");
assertInvalidSql("a``` ", "Unterminated quote");
checkTokens("``", "");
checkTokens("````", "`");
checkTokens("a````b", "a ` b");
checkTokens("a`\t``\t`b", "a \t`\t b");
checkTokens("`abc`", "abc");
checkTokens("`abc\ndef`", "abc\ndef");
checkTokens("a`abc\ndef`", "a abc\ndef");
checkTokens("`abc\ndef`b", "abc\ndef b");
checkTokens("a`abc\ndef`b", "a abc\ndef b");
checkTokens("a```abc\nd``ef```b", "a `abc\nd`ef` b");
}
@Test
public void testBrackets() {
assertInvalidSql("[", "Unterminated quote");
assertInvalidSql("a[", "Unterminated quote");
assertInvalidSql("a[ ", "Unterminated quote");
assertInvalidSql("a[[ ", "Unterminated quote");
checkTokens("[]", "");
checkTokens("[[]", "[");
checkTokens("a[[]b", "a [ b");
checkTokens("a[\t[\t]b", "a \t[\t b");
checkTokens("[abc]", "abc");
checkTokens("[abc\ndef]", "abc\ndef");
checkTokens("a[abc\ndef]", "a abc\ndef");
checkTokens("[abc\ndef]b", "abc\ndef b");
checkTokens("a[abc\ndef]b", "a abc\ndef b");
checkTokens("a[[abc\nd[ef[]b", "a [abc\nd[ef[ b");
}
@Test
public void testSemicolons() {
assertInvalidSql(";", "Semicolon is not allowed");
assertInvalidSql(" ;", "Semicolon is not allowed");
assertInvalidSql("; ", "Semicolon is not allowed");
assertInvalidSql("-;-", "Semicolon is not allowed");
checkTokens("--;\n", null);
checkTokens("/*;*/", null);
checkTokens("';'", null);
checkTokens("[;]", ";");
checkTokens("`;`", ";");
}
@Test
public void testTokens() {
checkTokens("a,abc,a00b,_1,_123,abcdef", "a abc a00b _1 _123 abcdef");
checkTokens("a--\nabc/**/a00b''_1'''ABC'''`_123`abc[d]\"e\"f",
"a abc a00b _1 _123 abc d e f");
}
}
......@@ -25,6 +25,7 @@ import android.content.SharedPreferences;
import android.os.ParcelUuid;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
import android.bluetooth.BluetoothAdapter;
......@@ -831,10 +832,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
== BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE ||
mDevice.getBluetoothClass().getDeviceClass()
== BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET) {
setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
} else {
setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_REJECTED);
EventLog.writeEvent(0x534e4554, "138529441", -1, "");
}
setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_REJECTED);
}
}
}
......
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