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

Commit 2e0b6084 authored by Bartosz Fabianowski's avatar Bartosz Fabianowski
Browse files

Populate Enterprise Privacy Settings page - batch 2

This CL adds the second batch of items to the Privacy Settings page.

These are all the remaining items that fall into the "What types of
information can your organization see?" category.

Test: make RunSettingsRoboTests
Bug: 32692748
Change-Id: I08569646ed6bb6f5d9d6d65ed2718be8456f50ae
parent 51ecc5ec
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -7983,20 +7983,28 @@
    <!-- Enterprise Privacy settings activity header, summarizing the powers that the admin has. [CHAR LIMIT=NONE] -->
    <string name="enterprise_privacy_header">To provide access to your work data, your organization may change settings and install software on your device, which could cause some of your personal content to be visible to your admin. Contact your organization\'s admin for more details.</string>
    <!-- Title for the 'What types of information can your organization see?' preference category. [CHAR LIMIT=60] -->
    <string name="exposure_category">What types of information can your organization see?</string>
    <string name="enterprise_privacy_exposure_category">What types of information can your organization see?</string>
    <!-- Title for the 'What changes affect what your organization can see?' preference category. [CHAR LIMIT=60] -->
    <string name="exposure_changes_category">What changes affect what your organization can see?</string>
    <string name="enterprise_privacy_exposure_changes_category">What changes affect what your organization can see?</string>
    <!-- Title for the 'What actions may impact your access to this device?' preference category. [CHAR LIMIT=60] -->
    <string name="device_access_category">What actions may impact your access to this device?</string>
    <string name="enterprise_privacy_device_access_category">What actions may impact your access to this device?</string>
    <!-- Label explaining that the admin can see data associated with his/her work account. [CHAR LIMIT=NONE] -->
    <string name="enterprise_data">Data associated with your work account, such as email and calendar</string>
    <string name="enterprise_privacy_enterprise_data">Data associated with your work account, such as email and calendar</string>
    <!-- Label explaining that the admin can see all apps installed on the device. [CHAR LIMIT=NONE] -->
    <string name="number_installed_packages_default">List of all apps on your device</string>
    <string name="enterprise_privacy_number_installed_packages_default">List of all apps on your device</string>
    <!-- Label explaining that the admin can see all apps installed on the device. [CHAR LIMIT=NONE] -->
    <plurals name="number_installed_packages">
    <plurals name="enterprise_privacy_number_installed_packages">
        <item quantity="one">List of all <xliff:g id="count">%d</xliff:g> app on your device</item>
        <item quantity="other">List of all <xliff:g id="count">%d</xliff:g> apps on your device</item>
    </plurals>
    <!-- Label explaining that the admin can see app usage statistics. [CHAR LIMIT=NONE] -->
    <string name="usage_stats">Usage (time spent and amount of data used) of each app on your device</string>
    <string name="enterprise_privacy_usage_stats">Usage (time spent and amount of data used) of each app on your device</string>
    <!-- Label explaining that the admin can retrieve network logs on the device. [CHAR LIMIT=NONE] -->
    <string name="enterprise_privacy_network_logs">Traffic logs on your device</string>
    <!-- Label explaining that the admin can request bug reports on the device. [CHAR LIMIT=NONE] -->
    <string name="enterprise_privacy_bug_reports">Your most recent bug report</string>
    <!-- Label explaining that the admin can retrieve security on from the device. [CHAR LIMIT=NONE] -->
    <string name="enterprise_privacy_security_logs">Your most recent security log</string>
    <!-- Label indicating that the date at which the admin last took a particular action was "never" (i.e. the admin never took the action so far). -->
    <string name="enterprise_privacy_never">Never</string>
</resources>
+21 −6
Original line number Diff line number Diff line
@@ -24,28 +24,43 @@
            android:summary="@string/enterprise_privacy_header"
            android:selectable="false"/>

    <PreferenceCategory android:title="@string/exposure_category">
    <PreferenceCategory android:title="@string/enterprise_privacy_exposure_category">
        <com.android.settings.DividerPreference
                android:key="enterprise_data"
                android:layout_height="wrap_content"
                android:title="@string/enterprise_data"
                android:title="@string/enterprise_privacy_enterprise_data"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="number_installed_packages"
                android:title="@string/number_installed_packages_default"
                android:title="@string/enterprise_privacy_number_installed_packages_default"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="usage_stats"
                android:title="@string/usage_stats"
                android:title="@string/enterprise_privacy_usage_stats"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="network_logs"
                android:title="@string/enterprise_privacy_network_logs"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="bug_reports"
                android:title="@string/enterprise_privacy_bug_reports"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="security_logs"
                android:title="@string/enterprise_privacy_security_logs"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
    </PreferenceCategory>

    <PreferenceCategory android:title="@string/exposure_changes_category">
    <PreferenceCategory android:title="@string/enterprise_privacy_exposure_changes_category">
    </PreferenceCategory>

    <PreferenceCategory android:title="@string/device_access_category">
    <PreferenceCategory android:title="@string/enterprise_privacy_device_access_category">
    </PreferenceCategory>
</PreferenceScreen>
+58 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.android.settings.enterprise;

import android.content.Context;
import android.support.v7.preference.Preference;
import android.text.format.DateUtils;

import com.android.settings.R;
import com.android.settings.core.PreferenceController;
import com.android.settings.overlay.FeatureFactory;

import java.util.Date;

public abstract class AdminActionPreferenceControllerBase extends PreferenceController {

    private final Context mContext;
    protected final EnterprisePrivacyFeatureProvider mFeatureProvider;

    public AdminActionPreferenceControllerBase(Context context) {
        super(context);
        mContext = context;
        mFeatureProvider = FeatureFactory.getFactory(context)
                .getEnterprisePrivacyFeatureProvider(context);
    }

    protected abstract Date getAdminActionTimestamp();

    @Override
    public void updateState(Preference preference) {
        final Date timestamp = getAdminActionTimestamp();
        preference.setSummary(timestamp == null ?
                mContext.getString(R.string.enterprise_privacy_never) :
                DateUtils.formatDateTime(mContext, timestamp.getTime(),
                        DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE));
    }

    @Override
    public boolean isAvailable() {
        return true;
    }

    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
        return false;
    }
}
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.android.settings.enterprise;

import android.content.Context;

import java.util.Date;

public class BugReportsPreferenceController extends AdminActionPreferenceControllerBase {

    private static final String KEY_BUG_REPORTS = "bug_reports";

    public BugReportsPreferenceController(Context context) {
        super(context);
    }

    @Override
    protected Date getAdminActionTimestamp() {
        return mFeatureProvider.getLastBugReportRequestTime();
    }

    @Override
    public String getPreferenceKey() {
        return KEY_BUG_REPORTS;
    }
}
+21 −0
Original line number Diff line number Diff line
@@ -31,4 +31,25 @@ public interface DevicePolicyManagerWrapper {
     * @see android.app.admin.DevicePolicyManager#getDeviceOwnerComponentOnAnyUser
     */
    ComponentName getDeviceOwnerComponentOnAnyUser();

    /**
     * Calls {@code DevicePolicyManager.getLastSecurityLogRetrievalTime()}.
     *
     * @see android.app.admin.DevicePolicyManager#getLastSecurityLogRetrievalTime
     */
    public long getLastSecurityLogRetrievalTime();

    /**
     * Calls {@code DevicePolicyManager.getLastBugReportRequestTime()}.
     *
     * @see android.app.admin.DevicePolicyManager#getLastBugReportRequestTime
     */
    public long getLastBugReportRequestTime();

    /**
     * Calls {@code DevicePolicyManager.getLastNetworkLogRetrievalTime()}.
     *
     * @see android.app.admin.DevicePolicyManager#getLastNetworkLogRetrievalTime
     */
    public long getLastNetworkLogRetrievalTime();
}
Loading