Search in sources :

Example 6 with AndroidPolicies

use of org.flyve.policies.manager.AndroidPolicies in project android-mdm-agent by flyve-mdm.

the class StatusBarPolicy method process.

@Override
protected boolean process() {
    try {
        boolean disable = Boolean.parseBoolean(this.policyValue.toString());
        AndroidPolicies androidPolicies = new AndroidPolicies(context, FlyveAdminReceiver.class);
        androidPolicies.disableStatusBar(disable);
        return true;
    } catch (Exception ex) {
        FlyveLog.e(this.getClass().getName() + ", process", ex.getMessage());
        return false;
    }
}
Also used : AndroidPolicies(org.flyve.policies.manager.AndroidPolicies)

Example 7 with AndroidPolicies

use of org.flyve.policies.manager.AndroidPolicies in project android-mdm-agent by flyve-mdm.

the class PasswordMinSymbolsPolicy method process.

@Override
protected boolean process() {
    try {
        int minimum = Integer.parseInt(this.policyValue.toString());
        AndroidPolicies androidPolicies = new AndroidPolicies(context, FlyveAdminReceiver.class);
        androidPolicies.setPasswordMinimumSymbols(minimum);
        return true;
    } catch (Exception ex) {
        FlyveLog.e(this.getClass().getName() + ", process", ex.getMessage());
        return false;
    }
}
Also used : AndroidPolicies(org.flyve.policies.manager.AndroidPolicies)

Example 8 with AndroidPolicies

use of org.flyve.policies.manager.AndroidPolicies in project android-mdm-agent by flyve-mdm.

the class MainActivity method onCreate.

/**
 * Called when the activity is starting
 * @param savedInstanceState if the activity is being re-initialized, it contains the data it most recently supplied
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // start MQTT
    globalStartMQTT();
    cache = new AppData(this);
    // Setup the DrawerLayout and NavigationView
    txtToolbarTitle = findViewById(R.id.txtToolbarTitle);
    mDrawerLayout = findViewById(R.id.drawerLayout);
    lstDrawer = findViewById(R.id.lstNV);
    lstDrawer.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mDrawerLayout.closeDrawers();
            selectedItem = arrDrawer.get(position);
            loadFragment(selectedItem, "");
        }
    });
    mFragmentManager = getSupportFragmentManager();
    // Setup Drawer Toggle of the Toolbar
    android.support.v7.widget.Toolbar toolbar = findViewById(R.id.toolbar);
    ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.app_name, R.string.app_name);
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerToggle.syncState();
    // check if come from notification like DeployApp
    int menuItemSelected = 0;
    String extra = "";
    String type = getIntent().getStringExtra("From");
    if (type != null) {
        switch(type) {
            case "DeployApp":
            case "RemoveApp":
                menuItemSelected = 1;
                extra = "DeployApp";
                break;
            case "PasswordPolicy":
                AndroidPolicies androidPolicies = new AndroidPolicies(MainActivity.this, FlyveAdminReceiver.class);
                androidPolicies.enablePassword(true, "", MainActivity.class);
        }
    }
    loadListDrawer(menuItemSelected, extra);
    checkNotifications();
    PoliciesAsyncTask.sendStatusbyHttp(MainActivity.this, true);
}
Also used : ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AppData(org.flyve.mdm.agent.data.localstorage.AppData) AdapterView(android.widget.AdapterView) AndroidPolicies(org.flyve.policies.manager.AndroidPolicies)

Example 9 with AndroidPolicies

use of org.flyve.policies.manager.AndroidPolicies in project android-mdm-agent by flyve-mdm.

the class FragmentTestPolicies method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_test_policies, container, false);
    cache = new PoliciesData(FragmentTestPolicies.this.getContext());
    mdm = new AndroidPolicies(FragmentTestPolicies.this.getContext(), FlyveAdminReceiver.class);
    customPolicies = new CustomPolicies(FragmentTestPolicies.this.getContext());
    Switch swGPS = v.findViewById(R.id.swGPS);
    swGPS.setChecked(Boolean.parseBoolean(cache.getValue(GPSPolicy.POLICY_NAME).value));
    swGPS.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                customPolicies.disableGps(isChecked);
            }
        }
    });
    Switch swAirplane = v.findViewById(R.id.swAirplane);
    swAirplane.setChecked(Boolean.parseBoolean(cache.getValue(AirplaneModePolicy.POLICY_NAME).value));
    swAirplane.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            customPolicies.disableAirplaneMode(isChecked);
        }
    });
    Switch swBluetooth = v.findViewById(R.id.swBluetooth);
    swBluetooth.setChecked(Boolean.parseBoolean(cache.getValue(BluetoothPolicy.POLICY_NAME).value));
    swBluetooth.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                customPolicies.disableBluetooth(isChecked);
            }
        }
    });
    Switch swWifi = v.findViewById(R.id.swWifi);
    swWifi.setChecked(Boolean.parseBoolean(cache.getValue(WifiPolicy.POLICY_NAME).value));
    swWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                customPolicies.disableWifi(isChecked);
            }
        }
    });
    Switch swNFC = v.findViewById(R.id.swNFC);
    swNFC.setChecked(Boolean.parseBoolean(cache.getValue(NFCPolicy.POLICY_NAME).value));
    swNFC.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                customPolicies.disableNFC(isChecked);
            }
        }
    });
    Switch swHostpot = v.findViewById(R.id.swHostpot);
    swHostpot.setChecked(Boolean.parseBoolean(cache.getValue(HostpotTetheringPolicy.POLICY_NAME).value));
    swHostpot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                customPolicies.disableHostpotTethering(isChecked);
            }
        }
    });
    Switch swMobileLine = v.findViewById(R.id.swMobileLine);
    swMobileLine.setChecked(Boolean.parseBoolean(cache.getValue(MobileLinePolicy.POLICY_NAME).value));
    swMobileLine.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                customPolicies.disableMobileLine(isChecked);
            }
        }
    });
    Button btnLock = v.findViewById(R.id.btnLock);
    btnLock.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mdm.lockScreen(LockActivity.class, getContext());
        }
    });
    Switch swDisableCamera = v.findViewById(R.id.swDisableCamera);
    swDisableCamera.setChecked(Boolean.parseBoolean(cache.getValue(CameraPolicy.POLICY_NAME).value));
    swDisableCamera.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mdm.disableCamera(isChecked);
        }
    });
    Switch swStorageEncryptionDevice = v.findViewById(R.id.swStorageEncryptionDevice);
    swStorageEncryptionDevice.setChecked(Boolean.parseBoolean(cache.getValue(StorageEncryptionPolicy.POLICY_NAME).value));
    swStorageEncryptionDevice.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mdm.storageEncryptionDevice(isChecked);
        }
    });
    Button btnReboot = v.findViewById(R.id.btnReboot);
    btnReboot.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mdm.reboot();
        }
    });
    Button btnClearMQTT = v.findViewById(R.id.btnCleatMQTT);
    btnClearMQTT.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                Helpers.deleteMQTTCache(FragmentTestPolicies.this.getContext());
            } catch (Exception ex) {
                FlyveLog.e(this.getClass().getName() + ", onCreateView", ex.getMessage());
            }
        }
    });
    final EditText edtPasswordLength = v.findViewById(R.id.edtPasswordLength);
    final EditText edtPasswordMinimumLetters = v.findViewById(R.id.edtPasswordMinimumLetters);
    final EditText edtPasswordMinimumLowerCase = v.findViewById(R.id.edtPasswordMinimumLowerCase);
    final EditText edtPasswordMinimumUpperCase = v.findViewById(R.id.edtPasswordMinimumUpperCase);
    final EditText edtPasswordMinimumNonLetter = v.findViewById(R.id.edtPasswordMinimumNonLetter);
    final EditText edtPasswordMinimumNumeric = v.findViewById(R.id.edtPasswordMinimumNumeric);
    final EditText edtPasswordMinimumSymbols = v.findViewById(R.id.edtPasswordMinimumSymbols);
    final EditText edtMaximumFailedPasswordsForWipe = v.findViewById(R.id.edtMaximumFailedPasswordsForWipe);
    final EditText edtMaximumTimeToLock = v.findViewById(R.id.edtMaximumTimeToLock);
    Button btnPassword = v.findViewById(R.id.btnPassword);
    btnPassword.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            int minimumLength = Integer.parseInt(edtPasswordLength.getText().toString());
            int minimumLetters = Integer.parseInt(edtPasswordMinimumLetters.getText().toString());
            int minimumUpperCase = Integer.parseInt(edtPasswordMinimumUpperCase.getText().toString());
            int minimumLowerCase = Integer.parseInt(edtPasswordMinimumLowerCase.getText().toString());
            int minimumNonLetter = Integer.parseInt(edtPasswordMinimumNonLetter.getText().toString());
            int minimumNumeric = Integer.parseInt(edtPasswordMinimumNumeric.getText().toString());
            int minimumSymbols = Integer.parseInt(edtPasswordMinimumSymbols.getText().toString());
            int maximumFailedPasswordsForWipe = Integer.parseInt(edtMaximumFailedPasswordsForWipe.getText().toString());
            int maximumTimeToLock = Integer.parseInt(edtMaximumTimeToLock.getText().toString());
            mdm.setPasswordLength(minimumLength);
            mdm.setPasswordMinimumLetters(minimumLetters);
            mdm.setPasswordMinimumUpperCase(minimumUpperCase);
            mdm.setPasswordMinimumLowerCase(minimumLowerCase);
            mdm.setPasswordMinimumNonLetter(minimumNonLetter);
            mdm.setPasswordMinimumNumeric(minimumNumeric);
            mdm.setPasswordMinimumSymbols(minimumSymbols);
            mdm.setMaximumFailedPasswordsForWipe(maximumFailedPasswordsForWipe);
            mdm.setMaximumTimeToLock(maximumTimeToLock);
        }
    });
    Button btnPasswordEnable = v.findViewById(R.id.btnPasswordEnable);
    btnPasswordEnable.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mdm.enablePassword(true, "", MainActivity.class);
        }
    });
    Button btnDownloadFile = v.findViewById(R.id.btnDownloadFile);
    btnDownloadFile.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new Thread(new Runnable() {

                public void run() {
                    // 
                    String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath() + "/CHANGELOG.md";
                    FlyveLog.d(path);
                    ConnectionHTTP.getSyncFile("https://raw.githubusercontent.com/flyve-mdm/android-mdm-agent/develop/CHANGELOG.md", path, "", new ConnectionHTTP.ProgressCallback() {

                        @Override
                        public void progress(int value) {
                        }
                    });
                }
            }).start();
        }
    });
    Button btnDownloadAPK = v.findViewById(R.id.btnDownloadAPK);
    btnDownloadAPK.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String path = new StorageFolder(getContext()).getDocumentsDir() + "/flyve-apk.apk";
            FlyveLog.d(path);
            ConnectionHTTP.getSyncFile("https://f-droid.org/repo/org.flyve.inventory.agent_37960.apk", path, "", new ConnectionHTTP.ProgressCallback() {

                @Override
                public void progress(int value) {
                }
            });
        }
    });
    Button btnEnablePassword = v.findViewById(R.id.btnEnablePassword);
    btnEnablePassword.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Helpers.sendToNotificationBar(getContext(), 1009, "MDM Agent", "Please create a new password", true, MainActivity.class, "TestPolicies");
        }
    });
    Button btnInstallSilently = v.findViewById(R.id.btnInstallSilently);
    btnInstallSilently.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            String path = new StorageFolder(FragmentTestPolicies.this.getContext()).getDownloadDir() + "/test.apk";
            Helpers.installApkSilently(path);
        }
    });
    return v;
}
Also used : EditText(android.widget.EditText) FlyveAdminReceiver(org.flyve.mdm.agent.receivers.FlyveAdminReceiver) CustomPolicies(org.flyve.policies.manager.CustomPolicies) View(android.view.View) PoliciesData(org.flyve.mdm.agent.data.database.PoliciesData) Switch(android.widget.Switch) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) AndroidPolicies(org.flyve.policies.manager.AndroidPolicies) CompoundButton(android.widget.CompoundButton) StorageFolder(org.flyve.mdm.agent.utils.StorageFolder)

Example 10 with AndroidPolicies

use of org.flyve.policies.manager.AndroidPolicies in project android-mdm-agent by flyve-mdm.

the class PoliciesAsyncTask method doInBackground.

protected Boolean doInBackground(Object... object) {
    final Context context = (Context) object[0];
    final Integer action = (Integer) object[1];
    final String topic = (String) object[2];
    final String message = (String) object[3];
    mHandler.post(new Runnable() {

        public void run() {
            switch(action) {
                case LOCK:
                    {
                        if (!MDMAgent.isSecureVersion()) {
                            try {
                                JSONObject jsonObj = new JSONObject(message);
                                if (jsonObj.has("lock")) {
                                    String lock = jsonObj.getString("lock");
                                    AndroidPolicies androidPolicies = new AndroidPolicies(context, FlyveAdminReceiver.class);
                                    if (lock.equalsIgnoreCase("now")) {
                                        // lock screen
                                        androidPolicies.lockScreen(LockActivity.class, context);
                                        // lock device
                                        androidPolicies.lockDevice();
                                    } else {
                                        // unlock screen
                                        if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && Settings.canDrawOverlays(context)) {
                                            try {
                                                MDMAgent mainActivity = ((MDMAgent) context);
                                                mainActivity.getLockActivity().unlockScreen();
                                            } catch (Exception e) {
                                            }
                                        }
                                        // unlock device
                                        androidPolicies.unlockDevice();
                                        Helpers.sendBroadcast("unlock", "org.flyvemdm.finishlock", context);
                                    }
                                }
                            } catch (Exception ex) {
                                FlyveLog.e(this.getClass().getName() + ", LOCK ", ex.getMessage());
                            }
                        }
                    }
                case PING:
                    {
                        String data = "{\"input\":{\"_pong\":\"!\"}}";
                        Routes routes = new Routes(context);
                        MqttData cache = new MqttData(context);
                        String url = routes.pluginFlyvemdmAgent(cache.getAgentId());
                        pluginHttpResponse(context, url, data);
                    }
                    break;
                case WIPE:
                    {
                        if (!MDMAgent.isSecureVersion()) {
                            try {
                                JSONObject jsonObj = new JSONObject(message);
                                if (jsonObj.has("wipe") && "NOW".equalsIgnoreCase(jsonObj.getString("wipe"))) {
                                    sendStatusbyHttp(context, false);
                                    new AndroidPolicies(context, FlyveAdminReceiver.class).wipe();
                                }
                            } catch (Exception ex) {
                                FlyveLog.e(this.getClass().getName() + ", WIPE ", ex.getMessage());
                            }
                        }
                    }
                    break;
                case UNENROLL:
                    {
                        // set offline
                        sendStatusbyHttp(context, false);
                        // Remove all the information
                        new ApplicationData(context).deleteAll();
                        new FileData(context).deleteAll();
                        new MqttData(context).deleteAll();
                        new PoliciesData(context).deleteAll();
                    }
                    break;
                case GEOLOCATE:
                    {
                        FastLocationProvider fastLocationProvider = new FastLocationProvider();
                        Routes routes = new Routes(context);
                        final String url = routes.pluginFlyvemdmGeolocation();
                        boolean isAvailable = fastLocationProvider.getLocation(context, new FastLocationProvider.LocationResult() {

                            @Override
                            public void gotLocation(Location location) {
                                if (location == null) {
                                    FlyveLog.e(this.getClass().getName() + ", sendGPS", "without location yet...");
                                    try {
                                        JSONObject jsonPayload = new JSONObject();
                                        jsonPayload.put("_datetime", Helpers.getUnixTime(context));
                                        jsonPayload.put("_agents_id", new MqttData(context).getAgentId());
                                        jsonPayload.put("computers_id", new MqttData(context).getComputersId());
                                        jsonPayload.put("_gps", "off");
                                        JSONObject jsonInput = new JSONObject();
                                        jsonInput.put("input", jsonPayload);
                                        String payload = jsonInput.toString();
                                        pluginHttpResponse(context, url, payload);
                                    } catch (Exception ex) {
                                        Helpers.storeLog("fcm", "Error on GPS location", ex.getMessage());
                                    }
                                } else {
                                    try {
                                        String latitude = String.valueOf(location.getLatitude());
                                        String longitude = String.valueOf(location.getLongitude());
                                        // "{"input":{"_agents_id":":id","_datetime":":string","latitude":":float","longitude":":float"}}"
                                        JSONObject jsonGPS = new JSONObject();
                                        jsonGPS.put("latitude", latitude);
                                        jsonGPS.put("longitude", longitude);
                                        jsonGPS.put("_datetime", Helpers.getUnixTime(context));
                                        jsonGPS.put("_agents_id", new MqttData(context).getAgentId());
                                        jsonGPS.put("computers_id", new MqttData(context).getComputersId());
                                        JSONObject jsonInput = new JSONObject();
                                        jsonInput.put("input", jsonGPS);
                                        String payload = jsonInput.toString();
                                        pluginHttpResponse(context, url, payload);
                                    } catch (Exception ex) {
                                        FlyveLog.e(this.getClass().getName() + ", sendGPS", ex.getMessage());
                                        Helpers.storeLog("fcm", "Error on GPS location", ex.getMessage());
                                    }
                                }
                            }
                        });
                        if (!isAvailable) {
                            try {
                                JSONObject jsonPayload = new JSONObject();
                                jsonPayload.put("_datetime", Helpers.getUnixTime(context));
                                jsonPayload.put("_agents_id", new MqttData(context).getAgentId());
                                jsonPayload.put("_gps", "off");
                                jsonPayload.put("computers_id", new MqttData(context).getComputersId());
                                JSONObject jsonInput = new JSONObject();
                                jsonInput.put("input", jsonPayload);
                                String payload = jsonInput.toString();
                                pluginHttpResponse(context, url, payload);
                            } catch (Exception ex) {
                                Helpers.storeLog("fcm", "Error on GPS location", ex.getMessage());
                            }
                        }
                    }
                    break;
                case INVENTORY:
                    {
                        Inventory inventory = new Inventory();
                        inventory.getXMLInventory(context, new InventoryTask.OnTaskCompleted() {

                            @Override
                            public void onTaskSuccess(String s) {
                                Routes routes = new Routes(context);
                                MqttData cache = new MqttData(context);
                                String url = routes.pluginFlyvemdmAgent(cache.getAgentId());
                                try {
                                    JSONObject jsonPayload = new JSONObject();
                                    jsonPayload.put("_inventory", Helpers.base64encode(s));
                                    JSONObject jsonInput = new JSONObject();
                                    jsonInput.put("input", jsonPayload);
                                    String payload = jsonInput.toString();
                                    pluginHttpResponse(context, url, payload);
                                    Helpers.storeLog("fcm", "Inventory", "Inventory Send");
                                } catch (Exception ex) {
                                    Helpers.storeLog("fcm", "Error on json createInventory", ex.getMessage());
                                }
                            }

                            @Override
                            public void onTaskError(Throwable throwable) {
                                Helpers.storeLog("fcm", "Error on createInventory", throwable.getMessage());
                            }
                        });
                    }
                case POLICIES:
                    {
                        // Policy/passwordEnabled
                        callPolicy(context, PasswordEnablePolicy.class, PasswordEnablePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordQuality
                        callPolicy(context, PasswordQualityPolicy.class, PasswordQualityPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinLength
                        callPolicy(context, PasswordMinLengthPolicy.class, PasswordMinLengthPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinLowerCase
                        callPolicy(context, PasswordMinLowerCasePolicy.class, PasswordMinLowerCasePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinUpperCase
                        callPolicy(context, PasswordMinUpperCasePolicy.class, PasswordMinUpperCasePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinNonLetter
                        callPolicy(context, PasswordMinNonLetterPolicy.class, PasswordMinNonLetterPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinLetters
                        callPolicy(context, PasswordMinLetterPolicy.class, PasswordMinLetterPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinNumeric
                        callPolicy(context, PasswordMinNumericPolicy.class, PasswordMinNumericPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/passwordMinSymbols
                        callPolicy(context, PasswordMinSymbolsPolicy.class, PasswordMinSymbolsPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/MaximumFailedPasswordsForWipe
                        callPolicy(context, MaximumFailedPasswordForWipePolicy.class, MaximumFailedPasswordForWipePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/MaximumTimeToLock
                        callPolicy(context, MaximumTimeToLockPolicy.class, MaximumTimeToLockPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/storageEncryption
                        callPolicy(context, StorageEncryptionPolicy.class, StorageEncryptionPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableCamera
                        callPolicy(context, CameraPolicy.class, CameraPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableBluetooth
                        callPolicy(context, BluetoothPolicy.class, BluetoothPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableHostpotTethering
                        callPolicy(context, HostpotTetheringPolicy.class, HostpotTetheringPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableRoaming
                        callPolicy(context, RoamingPolicy.class, RoamingPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableWifi
                        callPolicy(context, WifiPolicy.class, WifiPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableSpeakerphone
                        callPolicy(context, SpeakerphonePolicy.class, SpeakerphonePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableCreateVpnProfiles
                        callPolicy(context, VPNPolicy.class, VPNPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamMusic
                        callPolicy(context, StreamMusicPolicy.class, StreamMusicPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamRing
                        callPolicy(context, StreamRingPolicy.class, StreamRingPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamAlarm
                        callPolicy(context, StreamAlarmPolicy.class, StreamAlarmPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamNotification
                        callPolicy(context, StreamNotificationPolicy.class, StreamNotificationPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamAccessibility
                        callPolicy(context, StreamAccessibilityPolicy.class, StreamAccessibilityPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamVoiceCall
                        callPolicy(context, StreamVoiceCallPolicy.class, StreamVoiceCallPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStreamDTMF
                        callPolicy(context, StreamVoiceCallPolicy.class, StreamVoiceCallPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableScreenCapture
                        // ROOT REQUIRED
                        callPolicy(context, ScreenCapturePolicy.class, ScreenCapturePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableAirplaneMode
                        // ROOT REQUIRED
                        callPolicy(context, AirplaneModePolicy.class, AirplaneModePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableGPS
                        // ROOT REQUIRED
                        callPolicy(context, GPSPolicy.class, GPSPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableMobileLine
                        // ROOT
                        callPolicy(context, MobileLinePolicy.class, MobileLinePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableNfc
                        // ROOT
                        callPolicy(context, NFCPolicy.class, NFCPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableStatusBar
                        // ROOT
                        callPolicy(context, StatusBarPolicy.class, StatusBarPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableUsbMtp
                        // ROOT
                        callPolicy(context, UsbMtpPolicy.class, UsbMtpPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableUsbPtp
                        // ROOT
                        callPolicy(context, UsbPtpPolicy.class, UsbPtpPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/disableUsbAdb
                        // ROOT
                        callPolicy(context, UsbAdbPolicy.class, UsbAdbPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/deployApp
                        // ROOT
                        callPolicy(context, DeployAppPolicy.class, DeployAppPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/removeApp
                        // ROOT
                        callPolicy(context, RemoveAppPolicy.class, RemoveAppPolicy.POLICY_NAME, priority, topic, message);
                        // Policy/deployFile
                        // ROOT
                        callPolicy(context, DeployFilePolicy.class, DeployFilePolicy.POLICY_NAME, priority, topic, message);
                        // Policy/removeFile
                        // ROOT
                        callPolicy(context, RemoveFilePolicy.class, RemoveFilePolicy.POLICY_NAME, priority, topic, message);
                    }
                    break;
                default:
            }
        }
    });
    return true;
}
Also used : Context(android.content.Context) MqttData(org.flyve.mdm.agent.data.database.MqttData) MDMAgent(org.flyve.mdm.agent.ui.MDMAgent) FlyveAdminReceiver(org.flyve.mdm.agent.receivers.FlyveAdminReceiver) ApplicationData(org.flyve.mdm.agent.data.database.ApplicationData) Routes(org.flyve.mdm.agent.core.Routes) PoliciesData(org.flyve.mdm.agent.data.database.PoliciesData) InventoryTask(org.flyve.inventory.InventoryTask) JSONObject(org.json.JSONObject) FastLocationProvider(org.flyve.mdm.agent.utils.FastLocationProvider) AndroidPolicies(org.flyve.policies.manager.AndroidPolicies) FileData(org.flyve.mdm.agent.data.database.FileData) Inventory(org.flyve.mdm.agent.utils.Inventory) Location(android.location.Location)

Aggregations

AndroidPolicies (org.flyve.policies.manager.AndroidPolicies)19 View (android.view.View)2 PoliciesData (org.flyve.mdm.agent.data.database.PoliciesData)2 FlyveAdminReceiver (org.flyve.mdm.agent.receivers.FlyveAdminReceiver)2 Context (android.content.Context)1 Location (android.location.Location)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 AdapterView (android.widget.AdapterView)1 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1 EditText (android.widget.EditText)1 ListView (android.widget.ListView)1 Switch (android.widget.Switch)1 TextView (android.widget.TextView)1 InventoryTask (org.flyve.inventory.InventoryTask)1 Routes (org.flyve.mdm.agent.core.Routes)1 ApplicationData (org.flyve.mdm.agent.data.database.ApplicationData)1 FileData (org.flyve.mdm.agent.data.database.FileData)1 MqttData (org.flyve.mdm.agent.data.database.MqttData)1 AppData (org.flyve.mdm.agent.data.localstorage.AppData)1