48 lines
1.4 KiB
Java
48 lines
1.4 KiB
Java
package com.psmreborn.nopsmdrm;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageManager;
|
|
|
|
import java.io.File;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
|
|
import eu.chainfire.libsuperuser.Shell;
|
|
|
|
public class Helper {
|
|
|
|
private static Context ctx;
|
|
public static void setContext(Context context){
|
|
ctx = context;
|
|
}
|
|
public static boolean isNoPsmDrmAlreadyInstalled() {
|
|
try {
|
|
if(new File(getPsmApp().nativeLibraryDir, "libdefault_real.so").exists()){
|
|
return true;
|
|
}
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
public static boolean isPsmInstalled(){
|
|
try {
|
|
ctx.getPackageManager().getApplicationInfo("com.playstation.psstore", 0);
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static ApplicationInfo getPsmApp() throws PackageManager.NameNotFoundException {
|
|
ApplicationInfo pkg = ctx.getPackageManager().getApplicationInfo("com.playstation.psstore", 0);
|
|
return pkg;
|
|
}
|
|
public static String getDateTime(){
|
|
String formattedDate = new SimpleDateFormat("MM_dd_yyyy_HH_mm_ss").format(new Date());
|
|
return formattedDate;
|
|
}
|
|
}
|