Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0181f5e0 authored by Mohit Mali's avatar Mohit Mali
Browse files

Remove protect broadcast from manifest

parent 0b93579d
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -6,9 +6,7 @@

    <original-package android:name="com.android.settings" />

    <uses-permission android:name="foundation.e.apps"/>

    <protected-broadcast android:name="foundation.e.apps" />

    <uses-permission android:name="android.permission.REQUEST_NETWORK_SCORES" />
    <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
+30 −5
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import android.database.Cursor;
import android.net.Uri;
import android.content.ContentValues;

/**
 * Dashboard fragment to display application information from Settings. This activity presents
@@ -391,11 +394,20 @@ public class AppInfoDashboardFragment extends DashboardFragment
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_UNINSTALL) {
            // Refresh option menu
//                if (mAppEntry.info.packageName.equals("com.google.android.gms")){
//                    Intent broadcastIntent = new Intent();
//                    broadcastIntent.setAction("foundation.e.apps.debugg");
//                    broadcastIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
//                    sendImplicitBroadcast(getActivity(),broadcastIntent,"foundation.e.apps.debugg");
//                }

            if (mAppEntry.info.packageName.equals("com.google.android.gms")){
                    Intent broadcastIntent = new Intent();
                    broadcastIntent.setAction("foundation.e.apps.debugg");
                    broadcastIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
                    sendImplicitBroadcast(getActivity(),broadcastIntent,"foundation.e.apps.debugg");
                if (retrieveStatus(getActivity())!=null){
                    ContentValues values = new ContentValues();
                    values.put("installStatus","false");
                    getContentResolver().update(Uri.parse("content://custom.microg.STATUS/cte"), values,  "id=?",
                            new String[]{"1"});
                }
            }

            getActivity().invalidateOptionsMenu();
@@ -405,6 +417,19 @@ public class AppInfoDashboardFragment extends DashboardFragment
        }
    }

    public static String retrieveStatus(Context context) {
        String status = null;
        Cursor c = context.getContentResolver().query(Uri.parse("content://custom.microg.STATUS/cte"), null, "id=?", new String[]{"1"}, "installStatus");
        if (c.moveToFirst()) {
            do {
                status = c.getString(c.getColumnIndex("installStatus"));
                android.util.Log.e("TAG", "retrieveStatus: " + c.getString(c.getColumnIndex("installStatus")));
            } while (c.moveToNext());
        }
        return status;
    }


    private void sendImplicitBroadcast(Context ctxt, Intent intent,String application) {
        try {
            PackageManager pm = ctxt.getPackageManager();