-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: 一些基础更新 | Some basic updates (#14)
* build: Update the implementation component version * build: Modify APK naming * build: Add debug package build * style: Naming convention lowercase.
- Loading branch information
Showing
7 changed files
with
66 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.b3log.siyuan; | ||
|
||
import android.content.Context; | ||
import android.content.pm.ApplicationInfo; | ||
import android.content.pm.PackageManager; | ||
|
||
public class DebugModeChecker { | ||
|
||
/** | ||
* Checks if the current package name contains ".debug" and if debug mode is enabled. | ||
* | ||
* @param context The Android context used to retrieve the package information. | ||
* @return true if the package name contains ".debug" and debug mode is enabled, false otherwise. | ||
*/ | ||
public static boolean isDebugPackageAndMode(Context context) { | ||
PackageManager packageManager = context.getPackageManager(); | ||
ApplicationInfo appInfo = null; | ||
try { | ||
appInfo = packageManager.getApplicationInfo(context.getPackageName(), 0); | ||
} catch (PackageManager.NameNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
// Check if the package name contains ".debug" | ||
boolean isDebugPackage = context.getPackageName() != null && context.getPackageName().contains(".debug"); | ||
boolean isDebugMode = appInfo != null && (appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; | ||
return isDebugPackage && isDebugMode; | ||
} | ||
|
||
} |
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 was deleted.
Oops, something went wrong.