-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
277 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 14 additions & 12 deletions
26
safeToRun/src/main/java/com/safetorun/features/oscheck/emulator/emulators.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,42 @@ | ||
package com.safetorun.features.oscheck.emulator | ||
|
||
import android.os.Build | ||
import com.safetorun.features.oscheck.OSInformationQuery | ||
import com.safetorun.features.oscheck.OsCheckConstants | ||
import com.safetorun.features.oscheck.OsCheckConstants.XIAOMI | ||
import com.safetorun.features.oscheck.osInformationQuery | ||
|
||
/** | ||
* Return true if we're running on an emulator | ||
* | ||
* @return true if we're running on avd | ||
*/ | ||
inline fun banAvdEmulatorCheck() = | ||
isXiaomi().not() && (Build.BOOTLOADER == OsCheckConstants.UNKNOWN || | ||
Build.DEVICE == OsCheckConstants.AVD_DEVICE_TYPE || | ||
Build.BOARD == OsCheckConstants.AVD_EMULATOR_BOARD) | ||
inline fun banAvdEmulatorCheck(osInformationQuery: OSInformationQuery = osInformationQuery()) = | ||
isXiaomi(osInformationQuery).not() && (osInformationQuery.bootloader() == OsCheckConstants.UNKNOWN || | ||
osInformationQuery.device() == OsCheckConstants.AVD_DEVICE_TYPE || | ||
osInformationQuery.board() == OsCheckConstants.AVD_EMULATOR_BOARD) | ||
|
||
/** | ||
* Ban bluestacks | ||
* | ||
* @return true if we're running on bluestacks | ||
*/ | ||
inline fun banBluestacksEmulatorCheck() = | ||
isXiaomi().not() && Build.BOOTLOADER == OsCheckConstants.UNKNOWN | ||
inline fun banBluestacksEmulatorCheck(osInformationQuery: OSInformationQuery = osInformationQuery()) = | ||
isXiaomi(osInformationQuery).not() && osInformationQuery.bootloader() == OsCheckConstants.UNKNOWN | ||
|
||
/** | ||
* Ban the genymotion emulator | ||
* | ||
* @return true if we're running on the genymotion emulator | ||
*/ | ||
inline fun banGenymotionEmulatorCheck() = | ||
isXiaomi().not() && (Build.BOARD == OsCheckConstants.UNKNOWN || | ||
Build.MANUFACTURER == OsCheckConstants.GENYMOTION_MANUFACTURER || | ||
Build.BOOTLOADER == OsCheckConstants.UNKNOWN) | ||
inline fun banGenymotionEmulatorCheck(osInformationQuery: OSInformationQuery = osInformationQuery()) = | ||
isXiaomi(osInformationQuery).not() && (osInformationQuery.board() == OsCheckConstants.UNKNOWN || | ||
osInformationQuery.manufacturer() == OsCheckConstants.GENYMOTION_MANUFACTURER || | ||
osInformationQuery.bootloader() == OsCheckConstants.UNKNOWN) | ||
|
||
/** | ||
* Returns true if the device is a Xiaomi device | ||
* | ||
* @return true if we're on a Xiaomi device | ||
*/ | ||
inline fun isXiaomi() = Build.MANUFACTURER == XIAOMI | ||
inline fun isXiaomi(osInformationQuery: OSInformationQuery = osInformationQuery()) = | ||
osInformationQuery.manufacturer() == XIAOMI |
Oops, something went wrong.