@@ -1,4 +1,4 @@
|
||||
package aaa.QuestAppLauncher.App;
|
||||
package dev.oxmc.QuestAppLauncher;
|
||||
|
||||
import com.unity3d.player.UnityPlayerActivity;
|
||||
import android.app.Activity;
|
||||
@@ -104,22 +104,72 @@ public class AppInfo extends UnityPlayerActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean is2DApp(int i)
|
||||
public boolean isVrApp(ApplicationInfo app)
|
||||
{
|
||||
ApplicationInfo app = this.installedApps.get(i).app;
|
||||
if (null == app.metaData)
|
||||
{
|
||||
if (app.metaData != null) {
|
||||
String mode = app.metaData.getString("com.samsung.android.vr.application.mode");
|
||||
if ("vr_only".equals(mode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback checks
|
||||
// 1. Oculus / Meta categories
|
||||
if (app.packageName.contains("oculus") || app.packageName.contains("vr")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String vrAppMode = app.metaData.getString("com.samsung.android.vr.application.mode");
|
||||
if (null == vrAppMode || !vrAppMode.equals("vr_only")) {
|
||||
return true;
|
||||
}
|
||||
// 2. Required features (if you have PackageManager access)
|
||||
// e.g. FEATURE_VR_MODE, FEATURE_SENSOR_GYROSCOPE, etc.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isVrApp(PackageManager pm, ApplicationInfo app)
|
||||
{
|
||||
// 1. Strongest signal: explicit metadata
|
||||
if (app.metaData != null) {
|
||||
String mode = app.metaData.getString("com.samsung.android.vr.application.mode");
|
||||
if ("vr_only".equals(mode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Fallback checks: Oculus / Meta categories
|
||||
if (app.packageName.contains("oculus") || app.packageName.contains("vr")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 3. Check PackageInfo for features
|
||||
try {
|
||||
PackageInfo pkg = pm.getPackageInfo(app.packageName, PackageManager.GET_CONFIGURATIONS);
|
||||
|
||||
if (pkg.reqFeatures != null) {
|
||||
for (FeatureInfo feature : pkg.reqFeatures) {
|
||||
if (feature.name == null) continue;
|
||||
|
||||
switch (feature.name) {
|
||||
case "android.software.vr.mode":
|
||||
case "android.hardware.vr.headtracking":
|
||||
return true; // strong VR signal
|
||||
|
||||
case "android.hardware.sensor.gyroscope":
|
||||
// don't return yet — too weak alone
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (PackageManager.NameNotFoundException ignored) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean is2DApp(int i)
|
||||
{
|
||||
return !isVrApp(installedApps.get(i).app);
|
||||
}
|
||||
|
||||
public byte[] getIcon(int i) {
|
||||
try {
|
||||
Drawable drawable = this.getPackageManager().getApplicationIcon(installedApps.get(i).app);
|
||||
|
||||
Reference in New Issue
Block a user