🔧 chore(manifest,utils): remove unnecessary permissions check and dialog, update copyright notice

This commit is contained in:
sankalp committed 2025-06-30 13:58:13 +05:45
1 parent 5cea05828d
commit 1b33b8a441
7 files changed
+5 -271

No files matched your search

-2
View File
@@ -12,8 +12,6 @@
<!-- Permissions for app detection -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<!-- Accessibility service permission for lock screen functionality -->
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
@@ -88,7 +88,6 @@ import io.github.sankalp.lunox.dialogs.GlobalColorSizeDialog;
import io.github.sankalp.lunox.dialogs.GlobalSettingsDialog;
import io.github.sankalp.lunox.dialogs.HiddenAppsDialogs;
import io.github.sankalp.lunox.dialogs.PaddingDialog;
import io.github.sankalp.lunox.dialogs.PermissionDialog;
import io.github.sankalp.lunox.dialogs.RenameInputDialogs;
import io.github.sankalp.lunox.model.Apps;
import io.github.sankalp.lunox.model.Shortcut;
@@ -304,8 +303,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener,
// initGestures();
// Check permissions before loading apps
checkAndRequestPermissions();
// No permissions needed for basic launcher functionality
// loads the apps
loadApps();
@@ -1326,25 +1324,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener,
}
}
/**
* Check and request necessary permissions for app detection
*/
private void checkAndRequestPermissions() {
// Check if permissions dialog was already shown
if (DbUtils.isPermissionDialogShown()) {
return;
}
// Create the new permission dialog with proper theming
Context ctx;
if (DbUtils.getTheme() == R.style.Wallpaper)
ctx = new ContextThemeWrapper(this, R.style.AppTheme);
else
ctx = new ContextThemeWrapper(this, DbUtils.getTheme());
PermissionDialog permissionDialog = new PermissionDialog(ctx, this);
permissionDialog.show();
}
/**
* Show dialog to enable accessibility service for double tap to lock
@@ -1,146 +0,0 @@
/*
* Last Launcher
* Copyright (C) 2019 Shubham Tyagi
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.github.sankalp.lunox.dialogs;
import android.app.AppOpsManager;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import android.widget.Toast;
import io.github.sankalp.lunox.LauncherActivity;
import io.github.sankalp.lunox.R;
import io.github.sankalp.lunox.utils.DbUtils;
public class PermissionDialog extends Dialog implements View.OnClickListener {
private final LauncherActivity context;
private TextView usageAccessButton;
private TextView continueButton;
public PermissionDialog(Context context, LauncherActivity launcherActivity) {
super(context);
this.context = launcherActivity;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_permission_setup);
setCancelable(false);
// Initialize views
usageAccessButton = findViewById(R.id.permission_usage_access);
continueButton = findViewById(R.id.permission_continue);
// Set click listeners
usageAccessButton.setOnClickListener(this);
continueButton.setOnClickListener(this);
// Update button states
updatePermissionStates();
}
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.permission_usage_access) {
openUsageAccessSettings();
} else if (id == R.id.permission_continue) {
continueToLauncher();
}
}
private void openUsageAccessSettings() {
try {
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
context.startActivity(intent);
Toast.makeText(context, "Please enable Usage Access for Lunox", Toast.LENGTH_LONG).show();
} catch (Exception e) {
// Fallback to general settings if specific intent fails
Intent intent = new Intent(Settings.ACTION_SETTINGS);
context.startActivity(intent);
Toast.makeText(context, "Please find and enable Usage Access for Lunox in Settings", Toast.LENGTH_LONG).show();
}
}
private void continueToLauncher() {
// Mark permission dialog as shown
DbUtils.setPermissionDialogShown(true);
// Check if usage access permission is granted
boolean hasUsageAccess = checkUsageAccessPermission();
if (hasUsageAccess) {
dismiss();
context.loadApps(); // Reload apps after permissions are granted
} else {
Toast.makeText(context, "Please grant Usage Access permission to continue", Toast.LENGTH_LONG).show();
}
}
private boolean checkUsageAccessPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
int mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,
android.os.Process.myUid(), context.getPackageName());
return mode == AppOpsManager.MODE_ALLOWED;
}
return true; // For older versions, assume permission is granted
}
private void updatePermissionStates() {
// Update Usage Access button
boolean hasUsageAccess = checkUsageAccessPermission();
if (hasUsageAccess) {
usageAccessButton.setText("Usage Access ✓");
usageAccessButton.setAlpha(0.7f);
} else {
usageAccessButton.setText("Enable Usage Access");
usageAccessButton.setAlpha(1.0f);
}
}
@Override
protected void onStart() {
super.onStart();
// Update permission states when dialog becomes visible
updatePermissionStates();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
// Update permission states when user returns to the dialog
updatePermissionStates();
}
}
}
@@ -1,6 +1,6 @@
/*
* Last Launcher
* Copyright (C) 2019 Shubham Tyagi
* Lunox
* Copyright (C) 2025 Sankalp Tharu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,7 +61,6 @@ public class DbUtils {
private static final String GLOBAL_SIZE_ADDITION_EXTRA = "global_size_addition_extra";
private static final String APPS_COLORS_DEFAULT = "apps_color_default";
private static final String APPS_SORTS_TYPE = "apps_sorts_types";
private static final String PERMISSION_DIALOG_SHOWN = "permission_dialog_shown";
private static final String DOUBLE_TAP_TO_LOCK = "double_tap_to_lock";
@@ -379,19 +378,7 @@ public class DbUtils {
SpUtils.getInstance().putInt(APPS_SORTS_TYPE, type);
}
/**
* Check if permission dialog has been shown
*/
public static boolean isPermissionDialogShown() {
return SpUtils.getInstance().getBoolean(PERMISSION_DIALOG_SHOWN, false);
}
/**
* Set permission dialog as shown
*/
public static void setPermissionDialogShown(boolean shown) {
SpUtils.getInstance().putBoolean(PERMISSION_DIALOG_SHOWN, shown);
}
/**
* Check if double tap to lock is enabled
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Last Launcher
~ Copyright (C) 2019 Shubham Tyagi
~ Lunox
~ Copyright (C) 2025 Sankalp Tharu
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Last Launcher
~ Copyright (C) 2019 Shubham Tyagi
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout android:id="@+id/permission_linear_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp"
android:gravity="center"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Title -->
<TextView
android:id="@+id/permission_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="@string/permission_dialog_title"
android:textSize="24sp"
android:textStyle="bold" />
<!-- Description -->
<TextView
android:id="@+id/permission_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="@string/permission_dialog_message"
android:textSize="16sp"
android:lineSpacingMultiplier="1.2" />
<!-- Usage Access Permission -->
<TextView
android:id="@+id/permission_usage_access"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="15dp"
android:layout_margin="5dp"
android:text="Enable Usage Access"
android:textSize="20sp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true" />
<!-- Continue Button -->
<TextView
android:id="@+id/permission_continue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="15dp"
android:layout_margin="10dp"
android:layout_marginTop="20dp"
android:text="Continue to Lunox"
android:textSize="18sp"
android:textStyle="bold"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true" />
</LinearLayout>
-3
View File
@@ -93,9 +93,6 @@
<!-- Permission Dialog Strings -->
<string name="permission_dialog_title">Welcome to Lunox! 🚀</string>
<string name="permission_dialog_message">To provide the best launcher experience, Lunox needs this permission:\n\n<b>Usage Access</b> - Display all your apps\n\nTap the permission below to enable it.</string>
<!-- Frozen apps dialog title -->