OSDN Git Service

android-x86/frameworks-base.git
4 years agoOnly allow INSTALL_ALLOW_TEST from shell or root
Todd Kennedy [Fri, 20 Sep 2019 20:45:15 +0000 (13:45 -0700)]
Only allow INSTALL_ALLOW_TEST from shell or root

Bug: 141169173
Test: Manual. App can't be installed as test-only
Change-Id: Ib6dcca7901aa549d620448c0165c22270a3042be
Merged-In: Ib6dcca7901aa549d620448c0165c22270a3042be
(cherry picked from commit 702d394762a9b162cb2a2b04bb726fd8053f24d3)

4 years agoDO NOT MERGE Validate wallpaper dimension while generating crop
Ahan Wu [Thu, 26 Sep 2019 10:29:59 +0000 (18:29 +0800)]
DO NOT MERGE Validate wallpaper dimension while generating crop

If dimensions of cropped wallpaper image exceed max texture size that
GPU can support, it will cause ImageWallpaper keep crashing
because hwui crashes by invalid operation (0x502).

Bug: 120847476.
Test: Write a custom app to set a 8000x800 bitmap as wallpaper.
Test: The cropped file will be 29600x2960 and make sysui keep crashing.
Test: After applyed this cl, wallpaper will use fallback.
Test: Sysui will not keep crashing any more.
Change-Id: I8ed5931298c652a2230858cf62df3f6fcd345c5a
(cherry picked from commit f1e1f4f04d0165ed065637a4ba556583a7c79ef0)

4 years agoDo not compute outside given range in TextLine
Seigo Nonaka [Mon, 16 Sep 2019 21:49:49 +0000 (14:49 -0700)]
Do not compute outside given range in TextLine

This is second attempt of I646851973b3816bf9ba32dfe26748c0345a5a081
which breaks various layout test on application.
The empty string must be also handled by the TextLine since it
retrieves the default line height from the empty string.

Bug: 140632678
Test: StaticLayoutTest
Test: Manually done
Change-Id: I7089ed9b711dddd7de2b27c9c2fa0fb4cb53a735

4 years agoRESTRICT AUTOMERGE Strict SQLiteQueryBuilder needs to be stricter.
Jeff Sharkey [Tue, 16 Jul 2019 22:50:42 +0000 (16:50 -0600)]
RESTRICT AUTOMERGE Strict SQLiteQueryBuilder needs to be stricter.

Malicious callers can leak side-channel information by using
subqueries in any untrusted inputs where SQLite allows "expr" values.

This change offers setStrictGrammar() to prevent this by outright
blocking subqueries in WHERE and HAVING clauses, and by requiring
that GROUP BY and ORDER BY clauses be composed only of valid columns.

This change also offers setStrictColumns() to require that all
untrusted column names are valid, such as those in ContentValues.

Relaxes to always allow aggregation operators on returned columns,
since untrusted callers can always calculate these manually.

Bug: 135270103
Bug: 135269143
Test: atest android.database.sqlite.cts.SQLiteQueryBuilderTest
Test: atest FrameworksCoreTests:android.database.sqlite.SQLiteTokenizerTest
Exempt-From-Owner-Approval: already approved in downstream branch
Change-Id: I6290afd19c966a8bdca71c377c88210d921a9f25
(cherry picked from commit 216bbc2a2e4f697d88f8fd633646e3c0433246f1)

4 years agoSet default phonebook access to ACCESS_REJECTED when user didn't choose one
Zongheng Wang [Thu, 5 Sep 2019 20:44:28 +0000 (13:44 -0700)]
Set default phonebook access to ACCESS_REJECTED when user didn't choose one

When there's no users' choice to tell us whether to share their
phonebook information to the Bluetooth device, set the phonebook access
permission to ACCESS_REJECTED.

Bug: 138529441
Test: Manual test
Change-Id: Iefabeb731b941f09fe1272ac7b7cd2feba75c8df
Merged-In: Iefabeb731b941f09fe1272ac7b7cd2feba75c8df
(cherry picked from commit 9b3cb0f06b7c4907c293aa65e68c7ed6e4962d4b)

4 years agoRESTRICT AUTOMERGE Enable stricter SQLiteQueryBuilder options.
Jeff Sharkey [Thu, 18 Jul 2019 00:51:28 +0000 (18:51 -0600)]
RESTRICT AUTOMERGE Enable stricter SQLiteQueryBuilder options.

Malicious callers can leak side-channel information by using
subqueries in any untrusted inputs where SQLite allows "expr" values.

This change starts using setStrictColumns() and setStrictGrammar()
on SQLiteQueryBuilder to block this class of attacks.  This means we
now need to define the projection mapping of valid columns, which
consists of both the columns defined in the public API and columns
read internally by DownloadInfo.Reader.

We're okay growing sAppReadableColumnsSet like this, since we're
relying on our trusted WHERE clause to filter away any rows that
don't belong to the calling UID.

Remove the legacy Lexer code, since we're now internally relying on
the robust and well-tested SQLiteTokenizer logic.

Bug: 135270103
Bug: 135269143
Test: atest DownloadProviderTests
Test: atest CtsAppTestCases:android.app.cts.DownloadManagerTest
Change-Id: Iec1e8ce18dc4a9564318e0473d9d3863c8c2988a
(cherry picked from commit 382d5c0c199f3743514e024d2fd921248f7b14b3)

4 years agoAdd MANAGED_PROVISIONING_DPC_DOWNLOADED (nyc).
Jonathan Scott [Tue, 25 Jun 2019 09:58:06 +0000 (10:58 +0100)]
Add MANAGED_PROVISIONING_DPC_DOWNLOADED (nyc).

Test: Just adding a constant
Bug: 132261064
Change-Id: I1527be03a10fa1a2fde09e3e41d6b7e83a986fc0
Merged-In: I2bce277ff8f2de4614e19d5385fe6712b076f9c9
(cherry picked from commit 20e5d92613268c196b508865b7275b59f00688f5)

4 years ago[RESTRICT AUTOMERGE] Pass correct realCallingUid to startActivity() from startActivit...
Bryan Ferris [Tue, 21 May 2019 19:38:19 +0000 (12:38 -0700)]
[RESTRICT AUTOMERGE] Pass correct realCallingUid to startActivity() from startActivityInPackage

Previously startActivity would assume that the system was the calling user when
startActivityInPackage was called. Now the uid of the calling application is
forwarded by the system.

Test: manual; we added logging statements to check the value of realCallingUid
in startActivitiesMayWait when launching the calendar app from the calendar widget
and verified that it was the calendar uid rather than the system uid.

Bug: 123013720
Change-Id: I0ef42c2f89b537a720f1ad5aefac756b0ccac52e
Merged-In: I0ef42c2f89b537a720f1ad5aefac756b0ccac52e
(cherry picked from commit 216f65bf60a9fb6f3a495d083e5fbb54ae2a9f66)

4 years agoFix Layout.primaryIsTrailingPreviousAllLineOffsets
Mihai Popa [Tue, 25 Jun 2019 10:15:18 +0000 (11:15 +0100)]
Fix Layout.primaryIsTrailingPreviousAllLineOffsets

The CL fixes a crash in Layout.primaryIsTrailingPreviousAllLineOffsets.
The crash was happening when the method was called for a line beginning
with an empty bidi run. This could happen, for example, for empty text -
I was unable to find any other case. The CL improves the existing test
for the method with this case, which was previously crashing.

The CL also fixes a potential crash in getLineHorizontals. However, this
bug could never happen as in the current code path clamped is always
false (and kept as parameter for parity with getHorizontal).

Bug: 135444178
Bug: 78464361
Test: atest FrameworksCoreTests:android.text.LayoutTest\#testPrimaryIsTrailingPrevious
Change-Id: I47157abe1d74675884734e3810628a566e40c1b4
(cherry picked from commit 7ad499d00716f45fffdf7331493ed21d1b8d9b77)
(cherry picked from commit d3e81cd63f91533915feb159e0b4241729592963)

4 years agoHidProfile: sync isPreferred() with HidHostService
Chienyuan [Tue, 9 Jul 2019 07:09:56 +0000 (15:09 +0800)]
HidProfile: sync isPreferred() with HidHostService

HidHostService allow to connect when priority is PRIORITY_UNDEFINED.
HidProfile should return ture when priority is PRIORITY_UNDEFINED.
Otherwise, the "Input device" toggle in off state when HID device
connected.

Bug: 132456322
Test: manual
Change-Id: Id7bae694c57aec17e019d591c0a677e3cb64f845
(cherry picked from commit 830217f277e31e63d9ab8acd21ee2a8f81ee1c8f)

4 years agoClear the Parcel before writing an exception during a transaction
Michael Wachenschwanz [Thu, 16 May 2019 05:58:15 +0000 (22:58 -0700)]
Clear the Parcel before writing an exception during a transaction

This prevents any object data from being accidentally overwritten by the
exception, which could cause unexpected malformed objects to be sent
across the transaction.

Test: atest CtsOsTestCases:ParcelTest#testExceptionOverwritesObject
Bug: 34175893
Change-Id: Iaf80a0ad711762992b8ae60f76d861c97a403013
Merged-In: Iaf80a0ad711762992b8ae60f76d861c97a403013
(cherry picked from commit f8ef5bcf21c87d8617f5e11810cc94350298d114)

4 years agoProtect VPN dialogs against overlay.
Chalard Jean [Mon, 20 May 2019 04:11:37 +0000 (13:11 +0900)]
Protect VPN dialogs against overlay.

Bug: 130568701
Test: manual. After this, can't display on top of it
Change-Id: Ib032f800edb0416cc15f01a34954340d0d0ffa78
Merged-In: Ib032f800edb0416cc15f01a34954340d0d0ffa78
(cherry picked from commit 4e80dc2861614d25a1f957f50040a8cf04812d11)
(cherry picked from commit 016c72c8abfbae08eda269afb8923e8fc8a4ce44)

4 years agoMake Lock task default behaviour consistent with Settings.
Jonathan Scott [Tue, 7 May 2019 15:27:17 +0000 (16:27 +0100)]
Make Lock task default behaviour consistent with Settings.

Bug: 127605586
Test: Manual
Change-Id: I5b5b0f9184220a4ed3080ca27792f66d1f5d41aa
(cherry picked from commit fe9f143d2c713475ed2e354e893ea26f5c2f7afa)

4 years agoAutomatic translation import
Michael Bestas [Tue, 6 Aug 2019 17:31:05 +0000 (20:31 +0300)]
Automatic translation import

Change-Id: I8d3e72edb04d5cb6d9cc279418ec46d10b4a0f84

4 years ago[BACKPORT]NetworkManagement : Add ability to restrict app vpn usage
Uldiniad [Wed, 31 Oct 2018 02:32:03 +0000 (02:32 +0000)]
[BACKPORT]NetworkManagement : Add ability to restrict app vpn usage

Cherry-picked from https://review.lineageos.org/#/c/LineageOS/android_frameworks_base/+/232796/

VPN restriction independent from WiFi and mobile data.

Change-Id: I18728542e4a22733f4e096dc429386e61f2a3a06

4 years agoAdding SUPL NI Emergency Extension Time
WyattRiley [Thu, 6 Dec 2018 19:43:58 +0000 (11:43 -0800)]
Adding SUPL NI Emergency Extension Time

Configurable by carrier config.xml resource

Bug: 118839234
Bug: 115361555
Bug: 112159033
Test: On device, see b/115361555#comment14
Change-Id: I52e61656cca8b6fa6468d32d2e69bf60f4c83c61
(cherry picked from commit a725dd6650846090f70ed9811f1a94f036ab3f29)

4 years agoAdd cross user permission check - areNotificationsEnabledForPackage
Julia Reynolds [Wed, 27 Mar 2019 16:15:57 +0000 (12:15 -0400)]
Add cross user permission check - areNotificationsEnabledForPackage

Test: atest
Fixes: 128599467
Change-Id: I13a0ca7590f8c4b44379730e0ee2088aba400c2a
Merged-In: I13a0ca7590f8c4b44379730e0ee2088aba400c2a
(cherry picked from commit 657d164136199126ae241848887de0230699cea0)
(cherry picked from commit 63846a7093ca7c6d89b73fc77bdff267b3ecb4ef)

4 years agoLimit IsSeparateProfileChallengeAllowed to system callers
Pavel Grafov [Wed, 10 Apr 2019 11:47:25 +0000 (12:47 +0100)]
Limit IsSeparateProfileChallengeAllowed to system callers

Fixes: 128599668
Test: build, set up separate challenge
Change-Id: I2fef9ab13614627c0f1bcca04759d0974fc6181a
(cherry picked from commit 1b6301cf2430f192c9842a05fc22984d782bade9)

4 years agoPermission Check For DPM.getPermittedAccessibilityServices
Eran Messeri [Mon, 25 Mar 2019 14:31:04 +0000 (14:31 +0000)]
Permission Check For DPM.getPermittedAccessibilityServices

Bug: 128599660
Test: com.android.server.devicepolicy.DevicePolicyManagerTest
Test: com.google.android.gts.devicepolicy.DeviceOwnerTest
Change-Id: I8be915bd6a4ff99884d23005a4c6f0100806dbe8
Merged-In: I8ee3f876fcaffa63636645f0f59709cd147254ef
(cherry picked from commit 4fd13eefcf99d9b9b0d5f5ea99fdc7c799c83d23)

4 years agoAdded missing permission check to isPackageDeviceAdminOnAnyUser.
Varun Shah [Wed, 20 Mar 2019 18:10:33 +0000 (11:10 -0700)]
Added missing permission check to isPackageDeviceAdminOnAnyUser.

Added a check for the MANAGE_USERS permission to
PackageManagerService#isPackageDeviceAdminOnAnyUser.

To test that the method is still usable:
1) Enable virtual storage via: adb shell sm set-virtual-disk true
2) Follow instructions by clicking on notification to set up virtual storage
3) Go to Settings -> Apps & notifications -> See all X apps
4) Click on any non-system app (example Instagram)
5) Tap Storage and you should see a "Change" button (if not, choose another app)
6) Tap Change and you should see Internal and Virtual storage options listed
7) The above step confirms the method is still usable by Settings

Bug: 128599183
Test: SafetyNet logging (steps listed above)
Change-Id: I989f1daf52a71f6c778ebd81baa6f1bf83e9a718
Merged-In: I36521fa43daab399e08869647326a7ac32d1e512
(cherry picked from commit 18e7dedf6c35f07daf8b7239d501737745ac7f43)

5 years agoDO NOT MERGE - SUPL ES Extension - Safer Init and Not After Boot
WyattRiley [Tue, 19 Feb 2019 21:19:13 +0000 (13:19 -0800)]
DO NOT MERGE - SUPL ES Extension - Safer Init and Not After Boot

Safe order of pointer setting and background thread start
Verifying mCallEndElapsedRealtimeMillis is not the initial value

Bug: 112159033
Bug: 115361555
Bug: 125124724
Test: Verified not-after-boot with test code b/115361555#comment14
Test: Reproed NPE on Nexus 5x with test thread sleep and verify fix
Change-Id: I596f913bc79873274c2743132c93ef2381d9f3c7
(cherry picked from commit b5e7bbe5b8e1d120d3f13f6d15b7be16d4f2e132)

5 years agoClean up screenshot if nothing selected
Lyubo [Sun, 30 Dec 2018 16:40:05 +0000 (11:40 -0500)]
Clean up screenshot if nothing selected

If rect is null, run the finisher so the screenshot logic
is cleaned up and prepared for next screenshot. This fixes
BUGBASH-1831.

[basilgello: combined two if-clauses to avoid double else,
  inspired by @BadDaemon]
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
Change-Id: Ib46221df2a2a70bc5a901107ca6aa4268a0568f2

5 years agoAutomatic translation import
Michael Bestas [Sun, 10 Mar 2019 22:20:02 +0000 (00:20 +0200)]
Automatic translation import

Change-Id: I052bf8b0f683d45faeb500265605299f6fe24176

5 years agoSelect only preinstalled Spell Checker Services
Guliz Tuncay [Wed, 16 Aug 2017 19:02:31 +0000 (12:02 -0700)]
Select only preinstalled Spell Checker Services

When we are setting a new spell checker as the default one in
Secure.Settings, TSMS#findAvailSpellCheckerLocked can pick up
any available spell checker service. This violates the principle
that user should be warned whenever we are setting an untrusted
spell checker service as the default service, since the warning
dialog is never shown.

Fixes: 64764051
Bug: 118694079
Test: Manually as follows:
1. Open 'packages/inputmethods/LatinIME/java/AndroidManifest.xml'
     and remove 'AndroidSpellCheckerService'
2. lunch aosp_buillhead-userdebug && make -j
3. Flash the image
4. adb shell dumpsys textservices
    -> no spell checker is recognized
5. adb shell settings get secure selected_spell_checker
    -> null
6. tapas SampleSpellCheckerService
7. make -j
8. adb install -r $OUT/system/app/SampleSpellCheckerService/SampleSpellCheckerService.apk
9. adb shell dumpsys textservices
    -> SampleSpellCheckerService is recognized
10. adb shell settings get secure selected_spell_checker
    -> null

Change-Id: I16f12293d15258c9148677c7ee09fe6dcf81e81d
Merged-In: Idab3ecc246fe9344a09e6907a0ba39f8ea6506f9
(cherry picked from commit ed5973b8a8a2c0f0fc1f39c59c33f81882f41405)

5 years agoRESTRICT AUTOMERGE Do not linkify text with RLO/LRO characters.
Tony Mak [Thu, 29 Nov 2018 17:37:42 +0000 (17:37 +0000)]
RESTRICT AUTOMERGE Do not linkify text with RLO/LRO characters.

Also don't show smart actions for selections in text with unsupported
characters.

Bug: 116321860
Test: runtest -x cts/tests/tests/text/src/android/text/util/cts/LinkifyTest.java

Change-Id: Id271cab8aef6b9b13ef17f1a8654c7616f75cf13
(cherry picked from commit 73f398d306a8acf2dbb1dcff4042ecbaec5506a3)

5 years agoReturn WiFi data usage for WiFi-only devices
Vasyl Gello [Sun, 28 Oct 2018 21:28:42 +0000 (23:28 +0200)]
Return WiFi data usage for WiFi-only devices

Fixes "0B of data used" in "Data Usage" summary highlight
in Settings if Telephony is not present or turned off.

Reported-By: L.W Reek <syphyr@gmail.com>
Refactored-By: Michael W <baddaemon87@gmail.com>
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
Change-Id: I9623054c2e6e70060e65e93b18a11e8fb281d5d7

5 years agoRESTRICT AUTOMERGE: Recover shady content:// paths.
Jeff Sharkey [Mon, 24 Sep 2018 19:23:57 +0000 (13:23 -0600)]
RESTRICT AUTOMERGE: Recover shady content:// paths.

The path-permission element offers prefix or regex style matching of
paths, but most providers internally use UriMatcher to decide what
to do with an incoming Uri.

This causes trouble because UriMatcher uses Uri.getPathSegments(),
which quietly ignores "empty" paths.  Consider this example:

    <path-permission android:pathPrefix="/private" ... />

    uriMatcher.addURI("com.example", "/private", CODE_PRIVATE);

    content://com.example//private

The Uri above will pass the security check, since it's not
technically a prefix match.  But the UriMatcher will then match it
as CODE_PRIVATE, since it ignores the "//" zero-length path.

Since we can't safely change the behavior of either path-permission
or UriMatcher, we're left with recovering these shady paths by
trimming away zero-length paths.

Bug: 112555574
Test: cts-tradefed run cts -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AppSecurityTests
Change-Id: Ibadbfa4fc904ec54780c8102958735b03293fb9a
(cherry picked from commit a1ec7b115cc378f0547f10cf1074a5248d42d94f)

5 years agoPass userId through to singleton ContentProviders
Robin Lee [Thu, 28 Jul 2016 17:41:23 +0000 (18:41 +0100)]
Pass userId through to singleton ContentProviders

System content providers like SettingsProvider run as singleUser but
on receipt of a call make decisions based on the calling user ID.

This is right up until the caller is a system service or a cross-user-
-aware app like Settings, where putStringForUser etc. provide a
workaround for most settings but not for the few files SettingsProvider
exposes.

Change-Id: I90060c9c13e274edd71f8a16ab3a026a58b98e3e

5 years agoChanging SUPL_ES=1 for SUPL end point control
Wayne Lin [Thu, 13 Sep 2018 07:34:10 +0000 (15:34 +0800)]
Changing SUPL_ES=1 for SUPL end point control

SUPL_ES=1 ensures the GnssLocationProvider and related framework code
accepts incoming SMS SUPL_INIT messages with ES-bit=1
(which allow redirection of the ESLP
end-point e.g. to the current local emergency services provider when
you are travelling) only during an emergency call

Bug: 115331218
Bug: 112159033
Test: Build pass
Change-Id: I5075f7887a184ce18bb1815b35a2ce7acd8bca10
(cherry picked from commit 02f38c7284f183d5e1fc39fe56903a567ff3fc20)

5 years agoMake adb use a custom prop for adb root
syphyr [Sat, 24 Nov 2018 21:53:45 +0000 (22:53 +0100)]
Make adb use a custom prop for adb root

Change-Id: I684ba2fe939ab5c2c5fc43a7047b1b76aa2db332

5 years agoVerify number of Map entries written to Parcel
Michael Wachenschwanz [Sat, 25 Aug 2018 04:50:35 +0000 (21:50 -0700)]
Verify number of Map entries written to Parcel

Make sure the number of entries written by Parcel#writeMapInternal
matches the size written. If a mismatch were allowed, an exploitable
scenario could occur where the data read from the Parcel would not
match the data written.

Fixes: 112859604
Test: cts-tradefed run cts -m CtsOsTestCases -t android.os.cts.ParcelTest

Change-Id: I325d08a8b66b6e80fe76501359c41b6656848607
Merged-In: I325d08a8b66b6e80fe76501359c41b6656848607
(cherry picked from commit 057a01d1f38e9b46d3faa4059fdd7c8717681ea0)

5 years agoRESTRICT AUTOMERGE: Hide overlay windows when requesting media projection permission.
Wale Ogunwale [Wed, 16 May 2018 23:42:29 +0000 (16:42 -0700)]
RESTRICT AUTOMERGE: Hide overlay windows when requesting media projection permission.

1: Cherry-pick ag/4067454 - Setting PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS
updateNonSystemOverlayWindowsVisibilityIfNeeded on relayoutWindow

2: Cherry-pick ag/3650369 - If PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS changed on
relayoutWindow() then updateNonSystemOverlayWindowsVisibilityIfNeeded

3: Add permissions to SystemUI to allow it to hide non-system overlays

Bug: 34170870
Test: manual (see bug for poc)
Change-Id: I57cb0f390d9a78e721c5ddce49a377d385002753
(cherry picked from commit 40f7b5832291ec81b921d9d7598447653d926604)

5 years agoFix crash during cursor moving on BiDi text
Seigo Nonaka [Thu, 19 Jul 2018 23:22:02 +0000 (16:22 -0700)]
Fix crash during cursor moving on BiDi text

The crash was introduced by Ib66ef392c19c937718e7101f6d48fac3abe51ad0
The root cause of the crashing is requesting out-of-line access for the
horizontal width. This invalid access is silently ignored by
TextLine#measure() method but new implementation end up with out of
bounds access.

To makes behavior as old implementation, calling getHorizontal instead
of accessing measured result array.

Bug: 78464361111580019
Test: Manually done
Change-Id: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
(cherry picked from commit 960647d582911ae7ab8b9491097898e6c313aaf1)
Merged-In: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
(cherry picked from commit a1076fdaa54ebf56bb32bea43fb278f7470ff307)

5 years agoDO NOT MERGE. Persistable Uri grants still require permissions.
Jeff Sharkey [Tue, 7 Aug 2018 21:02:17 +0000 (15:02 -0600)]
DO NOT MERGE. Persistable Uri grants still require permissions.

When FLAG_GRANT_PERSISTABLE_URI_PERMISSION is requested, we still
need to check permissions between the source and target packages,
instead of shortcutting past them.

The spirit of the original change is remains intact: if the caller
requested FLAG_GRANT_PERSISTABLE_URI_PERMISSION, then we avoid
returning "-1", which would prevent the grant data structure from
being allocated.

Bug: 111934948
Test: atest android.appsecurity.cts.AppSecurityTests
Change-Id: Ief0fc922aa09fc3d9bb6a126c2ff5855347cd030
Merged-In: Ief0fc922aa09fc3d9bb6a126c2ff5855347cd030
(cherry picked from commit d6a6e7127cc341ca875d9d13cf7a864d9f20b479)

5 years agoAlways create grant structures when persistable.
Jeff Sharkey [Wed, 21 Dec 2016 20:27:04 +0000 (13:27 -0700)]
Always create grant structures when persistable.

Certain apps may already hold permissions to an underlying provider,
but they expect APIs like takePersistableUriPermission() and
getPersistedUriPermissions() to work when a permission grant was
extended with FLAG_GRANT_PERSISTABLE_URI_PERMISSION.

Test: builds, boots
Bug: 31239684
Change-Id: I4b21c57956b70133ecadb50d0d3ee339f41e2260

5 years agoOptimise the hit test algorithm
Mihai Popa [Wed, 9 May 2018 16:31:48 +0000 (17:31 +0100)]
Optimise the hit test algorithm

Layout#getOffsetForHorizontal was running in O(n^2) time, where n is the
length of the current line. The method is used when a touch event
happens on a text line, to compute the cursor offset (and the character)
where it happened. Although this is not an issue in common usecases,
where the number of characters on a line is relatively small, this can
be very inefficient as a consequence of Unicode containing 0-width
(invisible) characters. Specifically, there are characters defining the
text direction (LTR or RTL), which cause our algorithm to touch the
worst case quadratic runtime. For example, a person is able to send a
message containing a few visible characters, and also a lot of these
direction changing invisible ones. When the receiver touches the message
(causing the Layout#getOffsetForHorizontal method to be called), the
receiver's application would become not responsive.

This CL optimizes the method to run in O(n) worst case. This is achieved
by computing the measurements of all line prefixes at first, which can
be done in a single pass. Then, all the prefix measurement queries will
be answered in O(1), rather than O(n) as it was happening before.

Bug: 79215201
Test: manual testing
Change-Id: Ib66ef392c19c937718e7101f6d48fac3abe51ad0
Merged-In: Ib66ef392c19c937718e7101f6d48fac3abe51ad0

5 years agoAdd support for search in DownloadManager.
Ben Lin [Mon, 2 May 2016 23:45:45 +0000 (16:45 -0700)]
Add support for search in DownloadManager.

Bug: 26524617
Change-Id: I41c0f92381bec8ad06db73b25ec67466f368b55c

5 years agoDO NOT MERGE. Extend SQLiteQueryBuilder for update and delete.
Jeff Sharkey [Wed, 25 Jul 2018 20:52:14 +0000 (14:52 -0600)]
DO NOT MERGE. Extend SQLiteQueryBuilder for update and delete.

Developers often accept selection clauses from untrusted code, and
SQLiteQueryBuilder already supports a "strict" mode to help catch
SQL injection attacks.  This change extends the builder to support
update() and delete() calls, so that we can help secure those
selection clauses too.

Bug: 111085900
Test: atest packages/providers/DownloadProvider/tests/
Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java
Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Change-Id: Ib4fc8400f184755ee7e971ab5f2095186341730c
Merged-In: Ib4fc8400f184755ee7e971ab5f2095186341730c
(cherry picked from commit 506994268bc4fa07d8798b7737a2952f74b8fd04)

5 years agoDO NOT MERGE. Execute "strict" queries with extra parentheses.
Jeff Sharkey [Wed, 25 Jul 2018 20:01:59 +0000 (14:01 -0600)]
DO NOT MERGE. Execute "strict" queries with extra parentheses.

SQLiteQueryBuilder has a setStrict() mode which can be used to
detect SQL attacks from untrusted sources, which it does by running
each query twice: once with an extra set of parentheses, and if that
succeeds, it runs the original query verbatim.

This sadly doesn't catch inputs of the type "1=1) OR (1=1", which
creates valid statements for both tests above, but the final executed
query ends up leaking data due to SQLite operator precedence.

Instead, we need to continue compiling both variants, but we need
to execute the query with the additional parentheses to ensure
data won't be leaked.

Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Bug: 111085900
Change-Id: I6e8746fa48f9de13adae37d2990de11c9c585381
Merged-In: I6e8746fa48f9de13adae37d2990de11c9c585381
(cherry picked from commit 57b04a86802ff879af78e782a8582462323e34e7)

5 years agoAutomatic translation import
Michael Bestas [Sun, 14 Oct 2018 10:34:29 +0000 (13:34 +0300)]
Automatic translation import

Change-Id: Ie387b1de461949f51185c9616dbf8349de119b23

5 years agoBackport Prevent shortcut info package name spoofing
Makoto Onuki [Tue, 12 Jun 2018 20:01:42 +0000 (13:01 -0700)]
Backport Prevent shortcut info package name spoofing

Test: cts-tradefed run cts -m CtsShortcutManagerTestCases -t android.content.pm.cts.shortcutmanager.ShortcutManagerFakingPublisherTest
Bug: 109824443

Change-Id: I90443973aaef157d357b98b739572866125b2bbc
Merged-In: I78948446a63b428ae750464194558fd44a658493
(cherry picked from commit 9e21579a11219581a0c08ff5dd6ac4dc22e988a4)

5 years agoFix TrackInfo parcel write
Robert Shih [Mon, 9 Jul 2018 20:38:31 +0000 (13:38 -0700)]
Fix TrackInfo parcel write

Bug: 77600398
Change-Id: Ia316f1c5dc4879f6851fdb78fe8b9039579be7bc
(cherry picked from commit 0d2dc943dcaa3d7c8479e22ae62be9753ea2643c)

5 years agoResolve inconsistent parcel read in NanoAppFilter
Arthur Ishiguro [Mon, 25 Jun 2018 18:31:33 +0000 (11:31 -0700)]
Resolve inconsistent parcel read in NanoAppFilter

Bug: 77599679
Test: Compile only
Change-Id: Ib417a5cb4d51744442d2fb14437cabbe5fd1c266
(cherry picked from commit abe5a73a4a81e312a1690fbc10a6b99ce98b699a)

5 years agoMake safe label more safe
Todd Kennedy [Thu, 3 May 2018 09:05:04 +0000 (10:05 +0100)]
Make safe label more safe

* limit the absolute maximum size of the label to 50000 characters
[which is probably far more than necessary, but, can be dialed down]

* use a string buffer while processing the string [instead of creating
multiple string objects]

Bug: 62537081
Test: Manual. Install APK in bug and see that it can be uninstalled
Change-Id: Ibf63c2691ad7438a123e92110d95b1f50050f8b1
Merged-In: Ibf63c2691ad7438a123e92110d95b1f50050f8b1
(cherry picked from commit 2263da9539daef134395226a2718ba2d7af7547d)

5 years agoResStringPool: Prevenet boot loop from se fix
Ryan Mitchell [Mon, 21 May 2018 20:59:23 +0000 (13:59 -0700)]
ResStringPool: Prevenet boot loop from se fix

Changes the logs adding in a previous security fix to warnings so
devices with malformed APKs currently on them will not undergo DOS when
they are upgraded to P.

Bug: 79724567
Test: run cts -m CtsAppSecurityHostTestCases \
          -t android.appsecurity.cts.CorruptApkTests

Change-Id: Ied54e4bb14abdaf79da562022c7ea6075187c1f8
(cherry picked from commit f05f47b2c1838529e682ad8f931d3da72244b1a1)
(cherry picked from commit c31cf80008fdb06ea8e1eab9764096653e7854b1)

5 years agoFix DynamicRefTable::load security bug
Ryan Mitchell [Wed, 30 May 2018 19:17:01 +0000 (12:17 -0700)]
Fix DynamicRefTable::load security bug

DynamicRefTables parsed from apks are missing bounds checks that prevent
buffer overflows. This changes verifies the bounds of the header before
attempting to preform operations on the chunk.

Bug: 79488511
Test: run cts -m CtsAppSecurityHostTestCases \
        -t android.appsecurity.cts.CorruptApkTests

Change-Id: I02c8ad957da244fce777ac68a482e4e8fa70f846
Merged-In: I02c8ad957da244fce777ac68a482e4e8fa70f846
(cherry picked from commit 18a6ada4aa136da4f50f03fff91d61d448ced195)

5 years agoRemove unnecessary casts in postUpdateSlider()
Vasyl Gello [Wed, 25 Jul 2018 12:49:01 +0000 (15:49 +0300)]
Remove unnecessary casts in postUpdateSlider()

Change-Id: I1515b6b5c0859498668be66caeefe53fca20d0c8

5 years agoFix the "Alarm volume" icon is displayed incorrectly
Shigeki Yokomichi [Thu, 25 Feb 2016 08:17:39 +0000 (17:17 +0900)]
Fix the "Alarm volume" icon is displayed incorrectly

Symptom:
1. Set Alarm volume to 0 on Sound & notification screen, then tap
Back key and reopen the screen.
2. Set Alarm volume up to 1 or larger, then alarm icon changes to
unmute.
3. Set Alarm volume down to 0, then the icon doesn't change to
mute. There expected the icon should change to mute one.

Detail and sample:
SeekBarVolumizer manages a variable mLastAudibleStreamVolume.
This variable decides whether it executes mute procedure or not.
When this variable is 0, it will not execute mute procedure.
Because the condition to execute mute proceduce is below.
-  lastAudibleVolume * (mute ? -1 : 1) < 0
What original code will not update this variable from constructor
is one of problems. So once the icon changes to unmute one,
the icon will never change to mute one.

Solution:
Changed the condition as it doesn't depend on value of
lastAudibleVolume.

Bug: 30265487

Change-Id: I42165f39d1f344169674c09a045b6fb2bb25db4d

5 years agoPhoneWindowManager: Allow torch and track skip during ambient display
ezio84 [Sat, 7 Jul 2018 16:29:23 +0000 (18:29 +0200)]
PhoneWindowManager: Allow torch and track skip during ambient display

(Backport to cm-14.1)

This allows long press power button for torch and long press
volume buttons for track skip to work during ambient display.

sam3000/razorloves: partial pick from:

Author: ezio84 <brabus84@gmail.com>
Date:   Fri Feb 2 01:24:34 2018 -0500
    base: Support binding the power button to flashlight
    Thanks to beanstown106 for the initial longpress action calls in
    PhoneWindowManager (improved by lineage guys)
    [cut]
    Allow torch action also on ambient display
    Change-Id: I12da044f86c7b625872607529cf8524615cf576b

Author: ezio84 <brabus84@gmail.com>
Date:   Sun, 7 Jan 2018 21:24:53 +0100
    Fix volume rocker skip track on Ambient Display and Lift to Wake
    we need to check if dream service is dozing before checking
    keyguard status
    Change-Id: Ic3a6c830496188bb6edf27043cd24eb2d553bb82

Change-Id: I75f46a0dbfbc2308e51bca73fbaa9e646f73d9ab

5 years agoFix wrong peek height of the notification panel
dongwan0605.kim [Fri, 30 Dec 2016 06:46:50 +0000 (15:46 +0900)]
Fix wrong peek height of the notification panel

From N, the topmost notification slides in expanded from the top, not collapsed.
(https://android.googlesource.com/platform/frameworks/base/+/d1ad9ab3121cb54387c5d2b71b48708dcaed5c43)
But when peek from status bar, the peek height was measured with collapsed height.
Therefore fix the peek height with expanded height of the topmost notification.

Test: manual - Test peeking from status bar with expandable topmost notification.
Change-Id: I46173c9e82a1221b543133c38ec6aaf746244011
(cherry picked from commit c2ed273ca592e008917e74ad1f3ce9c9ccddd041)
(cherry picked from commit 09b798ab2041d792056a64562f73c8b11997b42e)

5 years agoFix an error with hardware keyboard shortcuts
nyz93 [Sat, 13 May 2017 12:35:06 +0000 (14:35 +0200)]
Fix an error with hardware keyboard shortcuts

Fixes the error which prevents keyboard shortcuts working when there is
no assistant application set up.

Change-Id: I2dd4af332ce58229e22007c154df4d38782d693a

5 years agoTuner: Move clock seconds option to status bar settings
Hendrik Hagendorn [Sun, 15 Jan 2017 09:00:12 +0000 (10:00 +0100)]
Tuner: Move clock seconds option to status bar settings

Change-Id: I532c179f06b934009d48433e50b69660247ee295

5 years agoDO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Hansong Zhang [Thu, 26 Apr 2018 21:22:39 +0000 (14:22 -0700)]
DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name

Test: manual
Bug: 73173182
Change-Id: I7f2201cab36adf7f01d1a794d783cb78a536811f
(cherry picked from commit 24da173b63b17a0bc6c80b2fcfefa7fe4574a15b)
CVE-2018-9432

5 years agokeyguard: Handle left icon visibility properly with wifi only devices
Brint E. Kriebel [Mon, 2 Jul 2018 22:57:22 +0000 (15:57 -0700)]
keyguard: Handle left icon visibility properly with wifi only devices

When telephony isn't available and the left icon has not yet been set to
a custom option, the left icon should be hidden.

This makes updateLeftAffordanceIcon and updateLeftButtonVisibility work
in a similar way to determine the icon visibility.

Change-Id: Ibb63ecef3c3cad73a19c04c85eccb93b423d5e80

5 years agoSystemUI: Toggle USB tethering only when USB is connected
Gabriele M [Fri, 27 Apr 2018 18:51:42 +0000 (20:51 +0200)]
SystemUI: Toggle USB tethering only when USB is connected

Pressing the tile when unplugged causes USB tethering to turn on
as soon as the cable is connected. This can happen long after the
tile has been pressed, so don't do anything if unplugged.

Change-Id: Ib8bbdc758097ca7af5d4e7c3483c28ba42fb9ce1

5 years agoRework thumbnail cleanup
Marco Nelissen [Tue, 7 Nov 2017 21:52:02 +0000 (13:52 -0800)]
Rework thumbnail cleanup

Bug: 63766886
Test: ran CTS tests
Change-Id: I1f92bb014e275eafe3f42aef1f8c817f187c6608
(cherry picked from commit 6d2096f3889d38da60099b1b5678347de4f042bf)
CVE-2018-9379

5 years agoResStringPool: Fix security vulnerability
rtmitchell@google.com [Fri, 6 Apr 2018 00:57:27 +0000 (17:57 -0700)]
ResStringPool: Fix security vulnerability

Adds detection of attacker-modified size and data fields passed to
ResStringPool::setTo(). These attacks are modified apks that AAPT would
not normally generate. In the rare case this occurs, the installation
cannot be allowed to continue.

Bug: 71361168
Bug: 71360999
Test: run cts -m CtsAppSecurityHostTestCases \
          -t android.appsecurity.cts.CorruptApkTests

Change-Id: If7eb93a9e723b16c8a0556fc4e20006aa0391d57
Merged-In: If7eb93a9e723b16c8a0556fc4e20006aa0391d57
(cherry picked from commit 7e54c3f261d81316b75cb734075319108d8bc1d1)
CVE-2018-9338, CVE-2018-9340

5 years agoAutomatic translation import
Michael W [Sun, 10 Jun 2018 14:04:46 +0000 (16:04 +0200)]
Automatic translation import

Change-Id: I4dc5e6ed7c2e4a636f9d23c112d81dbc69fbf255

5 years ago[BACKPORT] SystemUI: Fix alignment glitch with brightness mirror
Umang96 [Sun, 3 Jun 2018 07:35:39 +0000 (13:05 +0530)]
[BACKPORT] SystemUI: Fix alignment glitch with brightness mirror

Alignment of brightness mirror dialog was not exatly same as the
QS brightness dialog, which produced a visual glitch of slider
thumb shifting whenever we change brightness.
This is solved by dynamically handling the visibility of
mirror brightness icon, gone when brightness icon is off and
invisible when brightness icon is on, so that both mirror and
QS slider are equally aligned.

Change-Id: Ifb85643db669ee8d7473d3c48e7e4733428a77d6

5 years agoConnectivityService: move reportNetworkConnectivity to handler
Hugo Benichi [Thu, 6 Apr 2017 08:22:18 +0000 (17:22 +0900)]
ConnectivityService: move reportNetworkConnectivity to handler

This patch moves reportNetworkConnectivity onto the handler of
ConnectivityService.

This allows:
  - to inspect NetworkAgentInfo on the ConnectivityService handler,
    which is always more correct than doing so on a Binder thread.
  - to improve locking policies around NetworkAgentInfo.

Test: $ runtest frameworks-net
Bug: 3711961936902662
Change-Id: I49a765826e65c29a1995242290e5e7544112c94e

5 years agoConnectivityService: safer locking
Hugo Benichi [Thu, 6 Apr 2017 07:01:44 +0000 (16:01 +0900)]
ConnectivityService: safer locking

This path changes a dangerous lock path in reportNetworkConnectivity().
This methods is called outside of the main ConnectivityService handler
and takes a lock on a specific NetworkAgentInfo whose connectivity
status is being reported.

While this lock is held, reportNetworkConnectivity() goes on and query
the network policy state for that network, which may ends into
NetworkPolicyManagerService.

Instead, the lock on NetworkAgentInfo is only held long enough to make a
copy of LinkProperties, which is then passed to
NetworkPolicyManagerService without that lock.

Bug: 36902662
Test: could not repro b/36902662, reportNetworkConnectivity() works.
      $ runtest frameworks-net

Change-Id: Iac4b75bcecbdddb0ac695c8b1a87ae755f62f47f

5 years agoRevert "Prevent deadlock when using always-on legacy VPNs"
Gabriele M [Wed, 6 Jun 2018 13:28:46 +0000 (15:28 +0200)]
Revert "Prevent deadlock when using always-on legacy VPNs"

A different fix will be applied with follow-up changes. This also
doesn't appear to completely fix the problem (REGRESSION-1963).

This reverts commit ac496f4a070a5b050217335f512e0bb44cd90f32.

Change-Id: Ie77e2d4c58ce8c6be68f125d3311ecced6e1e7ca

5 years agoFix gear not showing when rotation or RTL changed
dongwan0605.kim [Mon, 16 Jan 2017 07:54:50 +0000 (16:54 +0900)]
Fix gear not showing when rotation or RTL changed

When rotation or RTL changed, gear button's translationX should be
updated to new position.

Test: (Rotation) Swipe notification to left > Gear is showing on the
right > Rotate the device > Gear button should be visible
Test: (RTL) Swipe notification to left > Set RTL language
> Swipe notification to right in RTL configuration
> Gear button should be visible

Change-Id: I04a657d380b746b30585ff8159b7a9b4865f423a

5 years agoSystemUI: Network Traffic [1/3]
Sam Mortimer [Mon, 21 May 2018 08:32:03 +0000 (10:32 +0200)]
SystemUI: Network Traffic [1/3]

*) Backport to cm-14.1

*) Add cmsdk internal NetworkTraffic to the statusbar
   using the CMStatusBarItemHolder helper.

Change-Id: Iba82b622099a415da5fe6d4ae923e3139b6dca52

5 years agoSystemUI: Add CM statusbar item holder
Sam Mortimer [Mon, 21 May 2018 08:30:07 +0000 (10:30 +0200)]
SystemUI: Add CM statusbar item holder

*) Backport to cm-14.1

*) To be used as a layout to hold one or more cmsdk status bar
   feature classes.

*) Propagates visibility and tint information via interfaces
   defined in cmsdk internal.

*) Supports adding further interfaces without impacting existing use
   cases.

Change-Id: I3b98837e076ba1cb0d4ca6e7588c1e917f81e65a

6 years agoAdd NETWORK_STACK permission
Rebecca Silberstein [Thu, 23 Mar 2017 07:29:28 +0000 (00:29 -0700)]
Add NETWORK_STACK permission

Add a new permission that only allows other system services to call
networking related methods.  This permission is intended to prevent
other apps from calling these methods that might leave networking
services in intermediate states.

Bug: 36538042
Test: build, run wifi unit tests, boots, wifi connects
Change-Id: Icba6ad5280e9a8863bd1c706ca34b7add8de5294

6 years agoCopy PermissionChecker from support lib and use in RcognitionService
Eugene Susla [Thu, 22 Feb 2018 18:39:34 +0000 (10:39 -0800)]
Copy PermissionChecker from support lib and use in RcognitionService

Fixes: 7351107673311729
Test: presubmit
Change-Id: Ie98f67ffee4744050ac85d8b229370a16a76a194
(cherry picked from commit 726b51a26e9a54b7352aad90ed15edccc44dd60d)
(cherry picked from commit 5a28e533fe8865ed371b5c0fd909a4ec89f63633)
CVE-2017-13316

6 years agoFixed Security Vulnerability of DcParamObject
Pengquan Meng [Fri, 9 Mar 2018 04:08:25 +0000 (20:08 -0800)]
Fixed Security Vulnerability of DcParamObject

The writeToParcel and readFromParcel is not symmetry, fixed it.

Test: no test
Bug: 70721937
Change-Id: I01f6f6b2ab778ee8b638d9b69fe0a6b9aa7ee395
(cherry picked from commit 8c55a70728fdb0a7b0585fac08629b0137dca51e)
CVE-2017-13315

6 years agoAdd permission check to setAllowOnlyVpnForUids
Rubin Xu [Thu, 11 Jan 2018 10:59:19 +0000 (10:59 +0000)]
Add permission check to setAllowOnlyVpnForUids

Bug: 63000005
Test: runtest frameworks-net -c com.android.server.connectivity.VpnTest
Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testAlwaysOnVpnLockDown
Merged-In: Ia1a82ee73d8617f3124032986fe6c09c14bf7752
Change-Id: Ia1a82ee73d8617f3124032986fe6c09c14bf7752
(cherry picked from commit f915e04d5010c4dfffad263fa70c1e412e856314)
CVE-2017-13314

6 years agoVerify last array's length in readFromParcel
Fyodor Kupolov [Wed, 21 Feb 2018 01:02:35 +0000 (17:02 -0800)]
Verify last array's length in readFromParcel

Length of the last array in readFromParcel should be the same as
value of mNextIndex.

Test: PoC app in the bug
Bug: 73252178
Change-Id: I69f935949e945c3a036b19b4f88684d906079ea5
(cherry picked from commit 3b8bc2e45048527d7682b24b96957c34433da382)
CVE-2017-13311

6 years agoUpdate internal ViewPager's SavedState to match Support Library version
Alan Viverette [Fri, 16 Feb 2018 18:56:02 +0000 (13:56 -0500)]
Update internal ViewPager's SavedState to match Support Library version

Merged-In: Ic4569b21d8a26a62bba91742b442f0c3ea8bcc9e
Change-Id: I17d085be9ce1a139e75264f1e715df7f565cd41b
Fixes: 71992105
Test: manual
(cherry picked from commit 187964aca12115c7ab66f59d1ebb95e4f4130ac6)
CVE-2017-13310

6 years agoUse calling user ID when calling isDeviceLocked
Fyodor Kupolov [Thu, 12 Oct 2017 18:22:57 +0000 (11:22 -0700)]
Use calling user ID when calling isDeviceLocked

If isDeviceLocked is called with clearCallingIdentity,
original userId should be explicitly passed

Bug: 67621847
Test: Manual
Change-Id: I2bcb92572898811cc96bda1149ef806e6239e929

6 years agoAutomatic translation import
Michael Bestas [Sat, 5 May 2018 16:19:40 +0000 (19:19 +0300)]
Automatic translation import

Change-Id: I6ca8357face163515c2d59778a9a350fedc0501a

6 years agoGlobalActions: Don't timeout a partial screenshot
Michael W [Sun, 22 Apr 2018 14:08:50 +0000 (16:08 +0200)]
GlobalActions: Don't timeout a partial screenshot

* A partial screenshot shouldn't timeout when the user might still be
  adjusting the rectangle
* This also fixes an issue, when views were removed from WindowManager
  multiple times, resulting in a crash

BUGBASH-1500

Change-Id: I5916545e9293717a96ecf191c9fb20db536cc730

6 years agoAutomatic translation import
Michael Bestas [Thu, 19 Apr 2018 19:45:05 +0000 (22:45 +0300)]
Automatic translation import

Change-Id: Ie3feee7796d76c1eafd62e9807ef90105c5d31d5

6 years agoAdjust URI host parsing to stop on \ character.
Adam Vartanian [Wed, 31 Jan 2018 11:05:10 +0000 (11:05 +0000)]
Adjust URI host parsing to stop on \ character.

The WHATWG URL parsing algorithm [1] used by browsers says that for
"special" URL schemes (which is basically all commonly-used
hierarchical schemes, including http, https, ftp, and file), the host
portion ends if a \ character is seen, whereas this class previously
continued to consider characters part of the hostname.  This meant
that a malicious URL could be seen as having a "safe" host when viewed
by an app but navigate to a different host when passed to a browser.

[1] https://url.spec.whatwg.org/#host-state

Bug: 71360761
Test: vogar frameworks/base/core/tests/coretests/src/android/net/UriTest.java (on NYC branch)
Test: cts -m CtsNetTestCases (on NYC branch)
Change-Id: Id53f7054d1be8d59bbcc7e219159e59a2425106e
(cherry picked from commit fa3afbd0e7a9a0d8fc8c55ceefdb4ddf9d0115af)
(cherry picked from commit 0b57631939f5824afef06517df723d2e766e0159)

6 years agoCheck for null-terminator in ResStringPool::string8At
Adam Lesinski [Fri, 10 Nov 2017 01:12:17 +0000 (17:12 -0800)]
Check for null-terminator in ResStringPool::string8At

All other stringAt methods check for null termination. Be consistent
so that upper levels don't end up with huge corrupt strings.

Bug: 62537081
Test: none
Change-Id: I17bdfb0c1e34507b66c6cad651bbdb12c5d4c417
(cherry picked from commit 3d35a0ea307693a97583a61973e729a5e7db2687)
(cherry picked from commit 97f8cb01149b35b1832c7f9efe85ff19edf1083e)
(cherry picked from commit 5ec65ae909a85d13d03c030be357c8c14a50d306)
(cherry picked from commit a2a36541f0b3603335e74da0a8d2b6a9d5bcec3f)

6 years ago[RTT] ParcelableRttResults parcel code fix
Etan Cohen [Fri, 2 Feb 2018 16:07:20 +0000 (08:07 -0800)]
[RTT] ParcelableRttResults parcel code fix

ParcelableRttResults was unparceled incorrectly.

Bug: 70398564
Test: exploit provided in bug no longer works
Change-Id: Ifd6de547e9861bbebc399b43d0cc2899a8160813
(cherry picked from commit e1e5a2409c8bef2481e68d9329f87bb8037afa45)
(cherry picked from commit 5a3d2708cd2289a4882927c0e2cb0d3c21a99c02)

6 years agoFix VerifyCredentialResponse parcelling code
Rubin Xu [Wed, 7 Feb 2018 08:10:08 +0000 (08:10 +0000)]
Fix VerifyCredentialResponse parcelling code

There was an asymmetry between parcelling and unparcelling of
VerifyCredentialResponse that could lead to type confusion if
packed with other objects in a Parcel.

Test: none
Bug: 71714464
Change-Id: Icff68879e249422ccca49f2bb7db85c35b4cb353
(cherry picked from commit 54813e988884f0d604d5358569f10feda8622f46)
(cherry picked from commit 09ba8fdffd9c8d74fdc6bfb51bcebc27fc43884a)

6 years agoAutomatic translation import
Michael Bestas [Tue, 27 Mar 2018 22:46:37 +0000 (01:46 +0300)]
Automatic translation import

Change-Id: I6cef227b477e9973eed48ed4345bbbc684f48f74

6 years agoSettingsProvider: Remove deprecated def_force_disable_navkeys default
Michael Bestas [Fri, 2 Mar 2018 23:25:43 +0000 (01:25 +0200)]
SettingsProvider: Remove deprecated def_force_disable_navkeys default

* It's been moved to cmsdk

Change-Id: I281f056a0c58998e639de69b9658f89eb5bc1046

6 years agoUpdate tint of resource icons of third party QS tiles
Gabriele M [Mon, 27 Nov 2017 17:59:25 +0000 (18:59 +0100)]
Update tint of resource icons of third party QS tiles

Since commit d2274f848c586d86404ae14dfb8d11a02ee4867a
("Fix animations for app QS tiles."), the tint of resource icons of
third party tiles doesn't change when the tile status changes. Keep
track of the tint so that changing the status of the icon will cause
an update of the icon.

BUGBASH-1239

Change-Id: Ib2a91a00b6912ae85f37dd096e62bb6b979e9fc7

6 years agoAutomatic translation import
Michael W [Sat, 17 Feb 2018 13:33:30 +0000 (14:33 +0100)]
Automatic translation import

Change-Id: I2d1c1294839b5a3ca059db6fc9241603f65d5ad4

6 years agoAutomatic translation import
Michael Bestas [Sun, 4 Feb 2018 02:31:47 +0000 (04:31 +0200)]
Automatic translation import

Change-Id: If98400e859be0cf1b18dc159c74ef3eaf3480553

6 years agoSystemUI: Fix LiveDisplay tile off color
qjohn [Fri, 14 Jul 2017 08:37:47 +0000 (15:37 +0700)]
SystemUI: Fix LiveDisplay tile off color

* Should match other icons when disabled.

Change-Id: Ic745d71b0eef0fca68a63e9558a43c203334e819

6 years agolivedisplay: Allow tile creation before boot completed phase [2/2]
Unpublished [Fri, 29 Dec 2017 22:00:01 +0000 (23:00 +0100)]
livedisplay: Allow tile creation before boot completed phase [2/2]

Change-Id: Ibef44d4e07da9baf296796515288c9d42aba8608

6 years agoSystemUI: Fix crash when taking screenshot in partial screenshot view
meganukebmp [Sat, 20 Jan 2018 01:11:11 +0000 (03:11 +0200)]
SystemUI: Fix crash when taking screenshot in partial screenshot view

Bug caused by the region selector and the animation using the same view.
This fix makes a dedicated view for the selector.

Change-Id: I12532ece4b3a742cba8f5c3852813fa339a04341

6 years agoGlobalActions: Misc power menu cleanup
Michael Bestas [Mon, 15 Jan 2018 00:12:10 +0000 (02:12 +0200)]
GlobalActions: Misc power menu cleanup

* Update drawable size to match AOSP icons
* Update airplane mode drawables
* Remove unused changes to modes we don't use
* Remove dead code
* Cleanup based on lineage-15.1 bringup comments

Change-Id: I59b7246857acd34d18baaedc286a66820560fa49

6 years agoGlobalActions: Fix setting ringer mode in global actions
Italian Quadcore [Tue, 9 Jun 2015 08:48:25 +0000 (10:48 +0200)]
GlobalActions: Fix setting ringer mode in global actions

* It looks like we missed some fixes while forward porting
  this feature from cm-13.0. Squash the following commits:

Author: Italian Quadcore <myawfulchat@gmail.com>
Date:   Tue Jun 9 10:48:25 2015 +0200

    Add Sound Panel to Power Menu (Part 1/2)

    Change-Id: I5a638b1817b3de82d891935e0071c6e42856c59e

Author: d34d <clark@cyngn.com>
Date:   Mon Feb 1 14:19:01 2016 -0800

    GlobalActions: Fix setting ringer mode in global actions

    It looks like we did not bring in this full feature for cm-13.0.
    This patch updates SilentModeTriStateAction to match cm-12.1 with
    one minor change.  We can no longer set the zen mode by writing to
    Global settings directly.  The ZenModeHelper class actually checks
    when a change is made and resets it.  The fix is to use
    INotificationManager.setZenMode() instead.

    Change-Id: Ib2423a19da3a2ca95f73cb92247e0a38bff8bbee
    TICKET: CYNGNOS-1808

Author: Dave Kover <kover@cyngn.com>
Date:   Tue Mar 1 13:37:57 2016 -0800

    Fix GlobalActions sound panel iconography.

    The priority and none icons were using old zen icons and did not
    match up with the status bar iconography. We are now in sync. Also
    aligning the prefix to match the other icons present in this dialog.
    Lastly, creating new drawables for the two sound options so that
    we don't clash designs with the Settings view, which also used the
    same icons.

    Change-Id: I0a0cee6c7f0f7b014a0b2cdd95b7f7e5cb8e5f38
    Ticket: CYNGNOS-2172

Author: d34d <clark@cyngn.com>
Date:   Tue Apr 12 10:13:22 2016 -0700

    GlobalActions: Always use setZenMode

    When set to silent mode, the user cannot change the ringer mode to
    vibrate or ring.  Notification manager listens for changes to the
    zen mode setting and will switch it back if there is a mismatch.
    Using INotificationManager.setZenMode takes care of changing the mode
    and keeping track of the updated change.

    Change-Id: I5139a9a8cde4ca59f64bd21cf7c184d4745a7d59
    TICKET: CYNGNOS-2417 BACON-4658

Change-Id: I5a638b1817b3de82d891935e0071c6e42856c59e

6 years agofw: GlobalActions: Always dismiss any existing dialog
Tom Marshall [Tue, 28 Jun 2016 16:43:10 +0000 (09:43 -0700)]
fw: GlobalActions: Always dismiss any existing dialog

The check for "mUiContext == null" is always false after the initial
dialog is created, causing the dismiss logic to never trigger.  All
code uses getUiContext() now, so the check is not necessary.  Remove
it and re-align the create/dismiss logic with AOSP.

Jira: BACON-4069

Change-Id: Ibba7b38a5fdc8410824db6d0a6f726f4a2822c9d

6 years agoThe DUT can't screen shot in guest mode
longyu.huang [Thu, 9 Apr 2015 07:09:43 +0000 (00:09 -0700)]
The DUT can't screen shot in guest mode

Change-Id: I6c40f8b5399ed1a8f9d52ddf0ed28266eea8f48c

6 years agoKeyguard: Don't apply input restriction if disabled by profile
Gabriele M [Wed, 10 Jan 2018 10:57:51 +0000 (11:57 +0100)]
Keyguard: Don't apply input restriction if disabled by profile

setKeyguardEnabled() applies some input restrictions when disabling
the lockscreen. This causes issues when a system profile disables the
lockscreen via this method, e.g. the home button stops working until
a profile re-enables the lockscreen with setKeyguardEnabled(). If the
current profile is disabling keyguard, don't restrict the inputs.

BUGBASH-504

Change-Id: Iaaaabecaf19a18911d276a47f826dec3dec045c1

6 years agoPhoneWindowManager: Make sure KeyDisabler is always called on boot
Paul Keith [Tue, 16 Jan 2018 14:47:07 +0000 (15:47 +0100)]
PhoneWindowManager: Make sure KeyDisabler is always called on boot

* Otherwise, some KeyDisabler classes are left in a weird state
* Because we don't keep track of whether an initial state was ever set,
  we never call KeyDisabler on boot if the setting is set to 0
* To remedy this, keep track of whether an initial state was set

Change-Id: Ib432ed3278dd8f4f4cba3ba488879b3c1cd9c8f4

6 years agoDO NOT MERGE Backporting potential usb tapjacking precaution.
Beverly [Fri, 1 Sep 2017 18:56:50 +0000 (14:56 -0400)]
DO NOT MERGE Backporting potential usb tapjacking precaution.

Bug: 62187985
Test: manual, backport
Change-Id: Iaceff6bb1da5fbf3d80a8e85923199bd8cab06bd
MERGED-IN: I3bdcd1876cd6dbe8a728bbce74edb52ab79f3e4c
MERGED-IN: Ic58ddd6d54e96f522445e67b90760dcfed13c27d

6 years agomtp: fix double free of thumbnail data
Chong Zhang [Tue, 24 Oct 2017 23:07:18 +0000 (16:07 -0700)]
mtp: fix double free of thumbnail data

bug: 67864232
Change-Id: I6eb51be839df12317273830521c70a4ed80f9496
(cherry picked from commit e6b98532ee03d0ac1ca93382699893172454a946)

6 years agoThrow OOME if Bitmap.nativeCreate fails
Leon Scroggins III [Tue, 3 Oct 2017 18:00:20 +0000 (14:00 -0400)]
Throw OOME if Bitmap.nativeCreate fails

Bug:33846679
Test: I6ab6cb7a3b3151641a9f9b02b0bfc484e0a4524b

This matches the old behavior, prior to switching from Java allocated
pixel memory to native allocations (b/27762775). It also better matches
what has happened - we ran out of memory. (Better than the current
behavior - NullPointerException in the Java code, or an alternative
solution of returning null, which would likely result in NPEs in the
calling code.)

Merged-In: I3958ed1106ac94fb1d3f30e044b620d984875211
Change-Id: I3958ed1106ac94fb1d3f30e044b620d984875211
(cherry picked from commit 5906a4869cdf5c39eba1d9a3125aff894c5e804d)

6 years agoAdjust Uri host parsing to use last instead of first @.
Adam Vartanian [Tue, 7 Nov 2017 12:22:23 +0000 (12:22 +0000)]
Adjust Uri host parsing to use last instead of first @.

Malformed authority segments can currently cause the parser to produce
a hostname that doesn't match the hostname produced by the WHATWG URL
parsing algorithm* used by browsers, which means that a URL could be seen
as having a "safe" host when checked by an Android app but actually visit
a different host when passed to a browser.  The WHATWG URL parsing
algorithm always produces a hostname based on the last @ in the authority
segment, so we do the same.

* https://url.spec.whatwg.org/#authority-state resets the "buffer", which
  is being used to build up the host name, each time an @ is found, so it
  has the effect of using the content between the final @ and the end
  of the authority section as the hostname.

Bug: 68341964
Test: vogar android.net.UriTest (on NYC branch)
Test: cts -m CtsNetTestCases (on NYC branch)
Change-Id: Idca79f35a886de042c94d6ab66787c2e98ac8376
(cherry picked from commit cd6228dd377b2a0caa02a1e6df92f3d9ae702a95)

6 years agoSysUI: Add Russian translation for accessibility_battery_level_charging
Alexander [Fri, 5 Jan 2018 10:51:29 +0000 (13:51 +0300)]
SysUI: Add Russian translation for accessibility_battery_level_charging

Change-Id: I6594d67c572c90e44b01335bf2a0785f47bc4ecf

6 years agoAutomatic translation import
Michael W [Sat, 13 Jan 2018 15:16:12 +0000 (16:16 +0100)]
Automatic translation import

Change-Id: I91439c40d8349ae2a50a2ec7c6d55d541097555a

6 years agoSystemUI: fix enabling burnIn protection
Miroslav Sustek [Tue, 19 Dec 2017 16:16:40 +0000 (17:16 +0100)]
SystemUI: fix enabling burnIn protection

Enabling the setting did not work because the SYSTEMUI_BURNIN_PROTECTION
string had wrong prefix and was not registered as tunable.

Change-Id: I6a99a7616b2e980aa8d4dfd86ba82351508825b2