Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the os codenames upto android Q #30

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,12 @@ public void onSuccess(final String adIdentifier, final boolean adDonotTrack) {
case NetworkType.CELLULAR_3G:
deviceDataMap.put(this.getString(string.network_type), "Cellular 3G");
break;
case NetworkType.CELLULAR_4G:
deviceDataMap.put(this.getString(string.network_type), "Cellular 4G");
case NetworkType.CELLULAR_4G_OR_5G_NSA:
deviceDataMap.put(this.getString(string.network_type), "Cellular 4G/5G NSA");
break;
case NetworkType.CELLULAR_5G_SA:
deviceDataMap.put(this.getString(string.network_type), "Cellular 5G SA");
break;

case NetworkType.WIFI_WIFIMAX:
deviceDataMap.put(this.getString(string.network_type), "Wifi/WifiMax");
break;
Expand All @@ -364,17 +366,6 @@ public void onSuccess(final String adIdentifier, final boolean adDonotTrack) {
deviceDataMap.put("Battery voltage",
easyBatteryMod.getBatteryVoltage() + " mV");

@BatteryHealth final int batteryHealth = easyBatteryMod.getBatteryHealth();
switch (batteryHealth) {
case BatteryHealth.GOOD:
deviceDataMap.put("Battery health", "Good");
break;
case BatteryHealth.HAVING_ISSUES:
default:
deviceDataMap.put("Battery health", "Having issues");
break;
}

@ChargingVia final int isChargingVia = easyBatteryMod.getChargingSource();
switch (isChargingVia) {
case ChargingVia.AC:
Expand All @@ -392,6 +383,17 @@ public void onSuccess(final String adIdentifier, final boolean adDonotTrack) {
break;
}

@BatteryHealth final int batteryHealth = easyBatteryMod.getBatteryHealth();
switch (batteryHealth) {
case BatteryHealth.GOOD:
deviceDataMap.put("Battery health", "Good");
break;
case BatteryHealth.HAVING_ISSUES:
default:
deviceDataMap.put("Battery health", "Having issues");
break;
}

//Bluetooth Mod
final EasyBluetoothMod easyBluetoothMod = new EasyBluetoothMod(this);
deviceDataMap.put("BT MAC Address", easyBluetoothMod.getBluetoothMAC());
Expand Down
32 changes: 26 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ buildscript {

repositories {
google()
jcenter()
mavenCentral()

jcenter() {
content {
// This is an AGP issue. Its been fixed in Canary version. Ideally it would be backported
// to stable version soon.
// https://github.com/signalapp/Signal-Android/issues/10906#issuecomment-774448564
includeModule("org.jetbrains.trove4j", "trove4j")
}
}
}

dependencies {
classpath Plugins.android

// Publish to Jcenter/Bintray
classpath Plugins.bintray
classpath Plugins.androidMaven

// Kotlin Plugin
classpath Plugins.kotlin

Expand All @@ -41,6 +46,21 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()

// Required by Lint (com.android.tools.lint:lint-gradle:27.1.3)
jcenter() {
content {
// This is an AGP issue. Its been fixed in Canary version. Ideally it would be backported
// to stable version soon.
// https://github.com/signalapp/Signal-Android/issues/10906#issuecomment-774448564
includeModule("org.jetbrains.trove4j", "trove4j")
}
}
}
}


task clean(type: Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repositories {
jcenter()
mavenCentral()
}

plugins {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
object Dependencies {

// Kotlin
const val kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin}"
const val kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"

// Testing
const val junit = "junit:junit:${Versions.junit}"
Expand Down
5 changes: 0 additions & 5 deletions buildSrc/src/main/java/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,4 @@ object Plugins {

// Kotlin
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"


// Publish
const val bintray = "com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintrayPlugin}"
const val androidMaven = "com.github.dcendents:android-maven-gradle-plugin:${Versions.androidMavenPlugin}"
}
12 changes: 5 additions & 7 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,20 @@ object Versions {

// Build Config
const val minSDK = 14
const val compileSDK = 29
const val compileSDK = 30
const val targetSDK = compileSDK

// Plugins
const val androidGradlePlugin = "3.6.0-rc01"
const val bintrayPlugin = "1.8.4"
const val androidMavenPlugin = "2.1"
const val androidGradlePlugin = "4.1.3"

// Dependencies
const val kotlin = "1.3.61"
const val kotlin = "1.4.31"
const val annotation = "1.1.0"
const val appCompat = "1.0.2"
const val appCompat = "1.1.0"
const val adIdentifier = "1.0.0-alpha03"

// Testing
const val junit = "4.12"
const val junit = "4.13"
const val junitExt = "1.1.1"
const val espresso = "3.2.0"
const val testRules = "1.2.0"
Expand Down
11 changes: 0 additions & 11 deletions configs/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
textOutput "stdout"
textReport true
checkAllWarnings true
warningsAsErrors true
showAll true
explainIssues true
abortOnError false
lintConfig file("$projectDir/lint.xml")
}
}

dependencies {
Expand Down
11 changes: 5 additions & 6 deletions configs/library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ apply plugin: 'com.android.library'

android {
defaultConfig {
versionCode Versions.libraryCode
versionName Versions.libraryName
versionCode
versionName

buildConfigField 'int', 'VERSION_CODE', "${Versions.libraryCode}"
buildConfigField 'String', 'VERSION_NAME', "\"${Versions.libraryName}\""
}

// Ignore Java 8 Doclint errors
Expand Down Expand Up @@ -68,7 +71,3 @@ project.ext.setupModuleNamesForPublishing = { final String libModuleName,
libraryDescription = libModuleDescription
}
}

// Place it at the end of the file
apply from: 'https://raw.githubusercontent.com/nisrulz/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nisrulz/JCenter/master/bintrayv1.gradle'
2 changes: 1 addition & 1 deletion easydeviceinfo-ads/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ext.setupModuleNamesForPublishing(ModuleName.ads, ModuleDesc.ads)
dependencies {
implementation Dependencies.adIdentifier

// Including the sub-module as Jcenter dependency
// Including the sub-module as remote maven dependency
// api "com.github.nisrulz:easydeviceinfo-common:$Versions.libraryName"

// Including the sub-module as module dependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import androidx.ads.identifier.AdvertisingIdClient;
import androidx.ads.identifier.AdvertisingIdInfo;
import androidx.annotation.NonNull;

import com.google.common.util.concurrent.ListenableFuture;

Expand All @@ -46,7 +47,7 @@ public interface AdIdentifierCallback {
* @param adIdentifier the ad identifier
* @param adDonotTrack the ad donot track
*/
void onSuccess(String adIdentifier, boolean adDonotTrack);
void onSuccess(@NonNull String adIdentifier, boolean adDonotTrack);
}

private Context context;
Expand All @@ -57,7 +58,7 @@ public interface AdIdentifierCallback {
*
* @param context the context
*/
public EasyAdsMod(final Context context) {
public EasyAdsMod(@NonNull final Context context) {
this.context = context.getApplicationContext();
}

Expand All @@ -66,7 +67,7 @@ public EasyAdsMod(final Context context) {
*
* @param callback the callback
*/
public final void getAndroidAdId(final AdIdentifierCallback callback) {
public final void getAndroidAdId(@NonNull final AdIdentifierCallback callback) {
executor.execute(new Runnable() {
@Override
public void run() {
Expand Down
2 changes: 1 addition & 1 deletion easydeviceinfo-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ext.setupModuleNamesForPublishing(ModuleName.base, ModuleDesc.base)
dependencies {
implementation Dependencies.annotation

// Including the sub-module as Jcenter dependency
// Including the sub-module as remote maven dependency
// api "com.github.nisrulz:easydeviceinfo-common:$Versions.libraryName"

// Including the sub-module as module dependency
Expand Down
2 changes: 1 addition & 1 deletion easydeviceinfo-base/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
~ limitations under the License.
-->

<manifest package="github.nisrulz.easydeviceinfo.base"/>
<manifest package="github.nisrulz.easydeviceinfo.base" />
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,22 @@ public final int getBatteryVoltage() {
@ChargingVia
public final int getChargingSource() {
final Intent batteryStatus = this.getBatteryStatusIntent();
int result = ChargingVia.UNKNOWN_SOURCE;
final int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);

switch (chargePlug) {
case BatteryManager.BATTERY_PLUGGED_AC:
return ChargingVia.AC;
result = ChargingVia.AC;
break;
case BatteryManager.BATTERY_PLUGGED_USB:
return ChargingVia.USB;
result = ChargingVia.USB;
break;
case BatteryManager.BATTERY_PLUGGED_WIRELESS:
return ChargingVia.WIRELESS;
default:
return ChargingVia.UNKNOWN_SOURCE;
result = ChargingVia.WIRELESS;
break;
}

return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,17 @@ public final String getOSCodename() {
codename = "Nougat";
break;
case VERSION_CODES.O:
codename = "O";
case VERSION_CODES.O_MR1:
codename = "Oreo";
break;
case VERSION_CODES.P:
codename = "Pie";
break;
case VERSION_CODES.Q:
codename = "Q";
raviyadav5951 marked this conversation as resolved.
Show resolved Hide resolved
break;
case VERSION_CODES.R:
codename = "11";
break;
default:
codename = EasyDeviceInfo.notFoundVal;
Expand Down
Loading