Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Issue 2745533002: Fixed permission check in SystemAccountManagerDelegate.updateCredentials (Closed)

Created:
3 years, 9 months ago by bsazonov
Modified:
3 years, 9 months ago
Reviewers:
nyquist, msarda
CC:
chromium-reviews, agrieve+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fixed permission check in SystemAccountManagerDelegate.updateCredentials Checking hasGetAccountsPermission before calling android.AccountManager.updateCredentials is irrelevant, because this call never required GET_ACCOUNTS permission. Added check for MANAGE_ACCOUNTS permission that was required before Android M. On M+ it doesn't require any special permission. BUG=699050 Review-Url: https://codereview.chromium.org/2745533002 Cr-Commit-Position: refs/heads/master@{#456124} Committed: https://chromium.googlesource.com/chromium/src/+/6e26494d0caa38a608ecd3c7852a58387dcaaf96

Patch Set 1 #

Total comments: 2

Patch Set 2 : Added MANAGE_ACCOUNTS check #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -7 lines) Patch
M components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java View 1 3 chunks +19 lines, -7 lines 4 comments Download

Messages

Total messages: 26 (16 generated)
bsazonov
Mihai, please take a look.
3 years, 9 months ago (2017-03-09 11:06:08 UTC) #2
msarda
Code LGTM, however I do not really know how permissions work. Maybe get a second ...
3 years, 9 months ago (2017-03-09 14:15:48 UTC) #7
nyquist
https://codereview.chromium.org/2745533002/diff/1/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java File components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java (left): https://codereview.chromium.org/2745533002/diff/1/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java#oldcode164 components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java:164: if (!hasGetAccountsPermission()) { Can we instead check whether we ...
3 years, 9 months ago (2017-03-09 22:16:55 UTC) #9
bsazonov
https://codereview.chromium.org/2745533002/diff/1/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java File components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java (left): https://codereview.chromium.org/2745533002/diff/1/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java#oldcode164 components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java:164: if (!hasGetAccountsPermission()) { On 2017/03/09 22:16:55, nyquist OOO back ...
3 years, 9 months ago (2017-03-10 17:49:17 UTC) #12
bsazonov
On 2017/03/10 17:49:17, bsazonov wrote: > https://codereview.chromium.org/2745533002/diff/1/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java > File > components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java > (left): > > ...
3 years, 9 months ago (2017-03-10 19:01:49 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2745533002/40001
3 years, 9 months ago (2017-03-10 19:03:01 UTC) #20
bsazonov
On 2017/03/09 14:15:48, msarda wrote: > Code LGTM, however I do not really know how ...
3 years, 9 months ago (2017-03-10 19:06:33 UTC) #21
nyquist
https://codereview.chromium.org/2745533002/diff/40001/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java File components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java (right): https://codereview.chromium.org/2745533002/diff/40001/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java#newcode166 components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java:166: if (callback != null) { if (callback == null) ...
3 years, 9 months ago (2017-03-10 19:07:45 UTC) #22
commit-bot: I haz the power
Committed patchset #2 (id:40001) as https://chromium.googlesource.com/chromium/src/+/6e26494d0caa38a608ecd3c7852a58387dcaaf96
3 years, 9 months ago (2017-03-10 19:12:03 UTC) #25
bsazonov
3 years, 9 months ago (2017-03-13 12:27:13 UTC) #26
Message was sent while issue was closed.
https://codereview.chromium.org/2745533002/diff/40001/components/signin/core/...
File
components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
(right):

https://codereview.chromium.org/2745533002/diff/40001/components/signin/core/...
components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java:166:
if (callback != null) {
On 2017/03/10 19:07:45, nyquist OOO back 3-14 wrote:
> if (callback == null) return;
> 
> It reduces indents, etc...

The Style Guide allows both one-line and braced if in this case, so it's up to
the developer (and the code consistency). I think that returns on separate lines
are easier to spot (and the rest of the file uses braced ifs anyway).

If you want, I can replace it with:

if (!hasManageAccountsPermission()) {
    if (callback == null) {
        return;
    }
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            callback.onResult(false);
        }
    });
    return;
}

Should I?

https://codereview.chromium.org/2745533002/diff/40001/components/signin/core/...
components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java:206:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
On 2017/03/10 19:07:45, nyquist OOO back 3-14 wrote:
> Optional nit: This can just be on one line. Fine like this too though.

See previous comment.

Powered by Google App Engine
This is Rietveld 408576698