Fix permissions lint errors.
- Add ACCESS_NETWORK_STATE to core library. It seems fairly fundamental. We should also be using it elsewhere (e.g. to fail fast if there's no network). - Add annotation to force apps using PlatformScheduler to declare RECEIVE_BOOT_PERMISSION ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194763051
This commit is contained in:
parent
9c15c63d4e
commit
c0fdbde903
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
|
|
||||||
<uses-feature android:name="android.software.leanback" android:required="false"/>
|
<uses-feature android:name="android.software.leanback" android:required="false"/>
|
||||||
|
@ -14,4 +14,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<manifest package="com.google.android.exoplayer2.core"/>
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.google.android.exoplayer2.core">
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
</manifest>
|
||||||
|
@ -26,6 +26,7 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
|
import android.support.annotation.RequiresPermission;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
@ -78,6 +79,7 @@ public final class PlatformScheduler implements Scheduler {
|
|||||||
* @param serviceAction The action which the service will be started with.
|
* @param serviceAction The action which the service will be started with.
|
||||||
* @param servicePackage The package of the service which contains the logic of the job.
|
* @param servicePackage The package of the service which contains the logic of the job.
|
||||||
*/
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.RECEIVE_BOOT_COMPLETED)
|
||||||
public PlatformScheduler(
|
public PlatformScheduler(
|
||||||
Context context,
|
Context context,
|
||||||
Requirements requirements,
|
Requirements requirements,
|
||||||
@ -103,6 +105,8 @@ public final class PlatformScheduler implements Scheduler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @RequiresPermission constructor annotation should ensure the permission is present.
|
||||||
|
@SuppressWarnings("MissingPermission")
|
||||||
private static JobInfo buildJobInfo(
|
private static JobInfo buildJobInfo(
|
||||||
Context context,
|
Context context,
|
||||||
Requirements requirements,
|
Requirements requirements,
|
||||||
|
@ -32,8 +32,6 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a set of device state requirements.
|
* Defines a set of device state requirements.
|
||||||
*
|
|
||||||
* <p>To use network type requirement, application needs to have ACCESS_NETWORK_STATE permission.
|
|
||||||
*/
|
*/
|
||||||
public final class Requirements {
|
public final class Requirements {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user