diff options
| author | sungmann.cho@navercorp.com <sungmann.cho@navercorp.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-13 03:36:10 +0000 | 
|---|---|---|
| committer | sungmann.cho@navercorp.com <sungmann.cho@navercorp.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-13 03:36:10 +0000 | 
| commit | 5767223cd767492916315514abdc58d312cd3984 (patch) | |
| tree | 6876657c6c5592e8905639b0b9c3559bdafaa2fb | |
| parent | 0e746ab758856abdc621b256faae3bdf7ea4fc29 (diff) | |
| download | chromium_src-5767223cd767492916315514abdc58d312cd3984.zip chromium_src-5767223cd767492916315514abdc58d312cd3984.tar.gz chromium_src-5767223cd767492916315514abdc58d312cd3984.tar.bz2 | |
Fix lint issues with Chromoting for Android.
Currently, the lint warns at:
Error: Field requires API level 18 (current min is 14):
    android.provider.Settings#EXTRA_ACCOUNT_TYPES [InlinedApi]
Error: Field requires API level 16 (current min is 14):
    android.view.View#SYSTEM_UI_FLAG_FULLSCREEN [InlinedApi]
So we need to add @TargetApi to suppress these lint error.
BUG=327768
Review URL: https://codereview.chromium.org/273313003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269995 0039d316-1c4b-4281-b951-d872f2087c98
| -rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/Chromoting.java | 3 | ||||
| -rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/Desktop.java | 20 | 
2 files changed, 15 insertions, 8 deletions
| diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java index f8a9849..837a8b9 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java @@ -10,6 +10,7 @@ import android.accounts.AccountManagerCallback;  import android.accounts.AccountManagerFuture;  import android.accounts.AuthenticatorException;  import android.accounts.OperationCanceledException; +import android.annotation.TargetApi;  import android.app.ActionBar;  import android.app.Activity;  import android.app.AlertDialog; @@ -18,6 +19,7 @@ import android.content.DialogInterface;  import android.content.Intent;  import android.content.SharedPreferences;  import android.content.res.Configuration; +import android.os.Build;  import android.os.Bundle;  import android.provider.Settings;  import android.util.Log; @@ -98,6 +100,7 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe          builder.setMessage(R.string.noaccounts_message);          builder.setPositiveButton(R.string.noaccounts_add_account,                  new DialogInterface.OnClickListener() { +                    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)                      @Override                      public void onClick(DialogInterface dialog, int id) {                          Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT); diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java index e4a8d0c..0f44e24 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java @@ -4,6 +4,7 @@  package org.chromium.chromoting; +import android.annotation.TargetApi;  import android.app.Activity;  import android.content.res.Configuration;  import android.os.Build; @@ -79,10 +80,7 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange          // IMMERSIVE_STICKY mode is used, the system clears this flag (leaving the FULLSCREEN flag          // set) when the user swipes the edge to reveal the bars temporarily. When this happens,          // the action-bar should remain hidden. -        int fullscreenFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE; -        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { -            fullscreenFlags |= View.SYSTEM_UI_FLAG_FULLSCREEN; -        } +        int fullscreenFlags = getSystemUiFlags();          if ((visibility & fullscreenFlags) != 0) {              hideActionBar();          } else { @@ -90,6 +88,15 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange          }      } +    @TargetApi(Build.VERSION_CODES.JELLY_BEAN) +    private int getSystemUiFlags() { +        int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE; +        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { +            flags |= View.SYSTEM_UI_FLAG_FULLSCREEN; +        } +        return flags; +    } +      public void showActionBar() {          mOverlayButton.setVisibility(View.INVISIBLE);          getActionBar().show(); @@ -106,10 +113,7 @@ public class Desktop extends Activity implements View.OnSystemUiVisibilityChange          // LOW_PROFILE gives the status and navigation bars a "lights-out" appearance.          // FULLSCREEN hides the status bar on supported devices (4.1 and above). -        int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE; -        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { -            flags |= View.SYSTEM_UI_FLAG_FULLSCREEN; -        } +        int flags = getSystemUiFlags();          // HIDE_NAVIGATION hides the navigation bar. However, if the user touches the screen, the          // event is not seen by the application and instead the navigation bar is re-shown. | 
