Skip to content

Commit

Permalink
Merge pull request #164 from charithag/master
Browse files Browse the repository at this point in the history
Add configurable disclaimer activity for GDPR
  • Loading branch information
charithag authored Mar 15, 2018
2 parents 2670d6c + 083e911 commit aba5f9a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
14 changes: 12 additions & 2 deletions client/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
targetSdkVersion 25
multiDexEnabled true

versionCode 3010031
versionName "3.1.31"
versionCode 3010032
versionName "3.1.32"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand All @@ -52,6 +52,8 @@ android {
}
// DEBUG_MODE_ENABLED: Make the agent print the debug logs.
buildConfigField "boolean", "DEBUG_MODE_ENABLED", "false"
// DISCLAIMER_ENABLED: Show disclaimer activity before start registrations.
buildConfigField "boolean", "DISCLAIMER_ENABLED", "true"
// ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE: Setting this to true will make the
// App list response to the service to include system apps as well.
buildConfigField "boolean", "ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE", "false"
Expand Down Expand Up @@ -179,6 +181,8 @@ android {
staging {
// DEBUG_MODE_ENABLED: Make the agent print the debug logs.
buildConfigField "boolean", "DEBUG_MODE_ENABLED", "true"
// DISCLAIMER_ENABLED: Show disclaimer activity before start registrations.
buildConfigField "boolean", "DISCLAIMER_ENABLED", "true"
// ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE: Setting this to true will make the
// App list response to the service to include system apps as well.
buildConfigField "boolean", "ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE", "false"
Expand Down Expand Up @@ -308,6 +312,8 @@ android {
// DEBUG_MODE_ENABLED: Make the agent print the debug logs.
// Make this false in production.
buildConfigField "boolean", "DEBUG_MODE_ENABLED", "true"
// DISCLAIMER_ENABLED: Show disclaimer activity before start registrations.
buildConfigField "boolean", "DISCLAIMER_ENABLED", "false"
// ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE: Setting this to true will make the
// App list response to the service to include system apps as well.
buildConfigField "boolean", "ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE", "false"
Expand Down Expand Up @@ -439,6 +445,8 @@ android {
// DEBUG_MODE_ENABLED: Make the agent print the debug logs.
// Make this false in production.
buildConfigField "boolean", "DEBUG_MODE_ENABLED", "false"
// DISCLAIMER_ENABLED: Show disclaimer activity before start registrations.
buildConfigField "boolean", "DISCLAIMER_ENABLED", "true"
// ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE: Setting this to true will make the
// App list response to the service to include system apps as well.
buildConfigField "boolean", "ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE", "false"
Expand Down Expand Up @@ -568,6 +576,8 @@ android {
// DEBUG_MODE_ENABLED: Make the agent print the debug logs.
// Make this false in production.
buildConfigField "boolean", "DEBUG_MODE_ENABLED", "true"
// DISCLAIMER_ENABLED: Show disclaimer activity before start registrations.
buildConfigField "boolean", "DISCLAIMER_ENABLED", "true"
// ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE: Setting this to true will make the
// App list response to the service to include system apps as well.
buildConfigField "boolean", "ALLOW_SYSTEM_APPS_IN_APPS_LIST_RESPONSE", "false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

import org.wso2.iot.agent.R;
import org.wso2.iot.agent.api.DeviceInfo;
import org.wso2.iot.agent.api.DeviceState;
import org.wso2.iot.agent.utils.Constants;
import org.wso2.iot.agent.utils.Response;

/**
* Activity which displays device information.
Expand All @@ -40,7 +43,15 @@ protected void onCreate(Bundle savedInstanceState) {
btnContinue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), AuthenticationActivity.class);
Class<?> nextActivityClass;
if (Constants.IS_CLOUD) {
nextActivityClass = AuthenticationActivity.class;
} else if (hasWorkProfileCapability()) {
nextActivityClass = WorkProfileSelectionActivity.class;
} else {
nextActivityClass = ServerConfigsActivity.class;
}
Intent intent = new Intent(getApplicationContext(), nextActivityClass);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
Expand All @@ -55,4 +66,13 @@ public void onClick(View v) {
});
}

/**
* Check capability to have a separate managed profile.
*/
private boolean hasWorkProfileCapability() {
DeviceState state = new DeviceState(this);
Response androidForWorkCompatibility = state.evaluateAndroidForWorkCompatibility();
return androidForWorkCompatibility.getCode();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void startActivity() {
instantiatedActivityClass = AlreadyRegisteredActivity.class;
} else if (Preference.hasPreferenceKey(this, Constants.TOKEN_EXPIRED)) {
instantiatedActivityClass = AuthenticationActivity.class;
} else if (Constants.IS_CLOUD) {
} else if (Constants.DISCLAIMER_ENABLED) {
instantiatedActivityClass = DisclaimerActivity.class;
} else if (hasWorkProfileCapability()) {
instantiatedActivityClass = WorkProfileSelectionActivity.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ protected void onCreate(Bundle savedInstanceState) {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void manageAndroidForWorkReception() {
if (manager.isProfileOwnerApp(getApplicationContext().getPackageName())) {
/* If the managed profile is already set up, we show the enrollment screen. */
/* If the managed profile is already set up, we show the enrollment screen. */
skipToEnrollment();
finish();
} else {
displayProfileProvisionPromptScreen();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class Constants {

public static final boolean IS_CLOUD = "release".equalsIgnoreCase(BuildConfig.BUILD_TYPE.trim());
public static final boolean DEBUG_MODE_ENABLED = BuildConfig.DEBUG_MODE_ENABLED;
public static final boolean DISCLAIMER_ENABLED = BuildConfig.DISCLAIMER_ENABLED;
public static final boolean SYSTEM_APP_ENABLED = BuildConfig.SYSTEM_APP_ENABLED;
public static final boolean AUTO_ENROLLMENT_BACKGROUND_SERVICE_ENABLED =
BuildConfig.AUTO_ENROLLMENT_BACKGROUND_SERVICE_ENABLED;
Expand Down
6 changes: 3 additions & 3 deletions client/client/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@
\n\n- Set screen lock password expiration: This permission is required to allow you to remotely set an expiration time for your screen lock password.
\n\n- Set storage encryption: This permission is required to allow remote encryption of your device storage.
\n\n- Disable cameras: This is required to for you to remotely allow/disallow camera usage on your device.
\n\nYou will be prompted to Activate Device Admin after registering your device with WSO2 Device cloud and by clicking "Activate" you consent to this App having access to the above administrator functions on your device.
\n\nYou will be prompted to Activate Device Admin after registering your device with WSO2 IoT Server and by clicking "Activate" you consent to this App having access to the above administrator functions on your device.
\n\nYou can revoke your consent at anytime by opening WSO2 Device Management Agent app and clicking on "Unregister" or by going to Settings \-\>Security \-\> Device Administrators and Deactivating WSO2 Device Management Agent.
\n\nAll remote operations can only be triggered from the Device Management Console in the WSO2 Device Cloud and can only be performed by authorized user.
\n\nAll data sent to the WSO2 Device cloud is only accessible to the authorized user and can be permanently removed if needed.
\n\nAll remote operations can only be triggered from the Device Management Console in the WSO2 IoT Server and can only be performed by authorized user.
\n\nAll data sent to the WSO2 IoT Server is only accessible to the authorized user and can be permanently removed if needed.
</string>
<string name="hint_retype_pin">Retype PIN Code</string>
<string name="lbl_pin_title">Please enter PIN code</string>
Expand Down

0 comments on commit aba5f9a

Please sign in to comment.