| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.base; | 5 package org.chromium.base; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.os.Build; | 9 import android.os.Build; |
| 10 import android.provider.Settings; | 10 import android.provider.Settings; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME") | 68 @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME") |
| 69 private static File getAlternativeCommandLinePath(Context context, String fi
leName) { | 69 private static File getAlternativeCommandLinePath(Context context, String fi
leName) { |
| 70 File alternativeCommandLineFile = | 70 File alternativeCommandLineFile = |
| 71 new File(COMMAND_LINE_FILE_PATH_DEBUG_APP, fileName); | 71 new File(COMMAND_LINE_FILE_PATH_DEBUG_APP, fileName); |
| 72 if (!alternativeCommandLineFile.exists()) return null; | 72 if (!alternativeCommandLineFile.exists()) return null; |
| 73 try { | 73 try { |
| 74 if (BuildInfo.isDebugAndroid()) { | 74 if (BuildInfo.isDebugAndroid()) { |
| 75 return alternativeCommandLineFile; | 75 return alternativeCommandLineFile; |
| 76 } | 76 } |
| 77 | 77 |
| 78 String debugApp = Build.VERSION.SDK_INT < 17 | 78 String debugApp = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_
BEAN_MR1 |
| 79 ? getDebugAppPreJBMR1(context) : getDebugAppJBMR1(context); | 79 ? getDebugAppPreJBMR1(context) |
| 80 : getDebugAppJBMR1(context); |
| 80 | 81 |
| 81 if (debugApp != null | 82 if (debugApp != null |
| 82 && debugApp.equals(context.getApplicationContext().getPackag
eName())) { | 83 && debugApp.equals(context.getApplicationContext().getPackag
eName())) { |
| 83 return alternativeCommandLineFile; | 84 return alternativeCommandLineFile; |
| 84 } | 85 } |
| 85 } catch (RuntimeException e) { | 86 } catch (RuntimeException e) { |
| 86 Log.e(TAG, "Unable to detect alternative command line file"); | 87 Log.e(TAG, "Unable to detect alternative command line file"); |
| 87 } | 88 } |
| 88 | 89 |
| 89 return null; | 90 return null; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 104 private static String getDebugAppPreJBMR1(Context context) { | 105 private static String getDebugAppPreJBMR1(Context context) { |
| 105 boolean adbEnabled = Settings.System.getInt(context.getContentResolver()
, | 106 boolean adbEnabled = Settings.System.getInt(context.getContentResolver()
, |
| 106 Settings.System.ADB_ENABLED, 0) == 1; | 107 Settings.System.ADB_ENABLED, 0) == 1; |
| 107 if (adbEnabled) { | 108 if (adbEnabled) { |
| 108 return Settings.System.getString(context.getContentResolver(), | 109 return Settings.System.getString(context.getContentResolver(), |
| 109 Settings.System.DEBUG_APP); | 110 Settings.System.DEBUG_APP); |
| 110 } | 111 } |
| 111 return null; | 112 return null; |
| 112 } | 113 } |
| 113 } | 114 } |
| OLD | NEW |