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

Commit 8a23c93f authored by Kevin Tang's avatar Kevin Tang Committed by Linux Build Service Account
Browse files

made izat Opt In icon indicate the Opt In status

Switch the layout entry order and moved up Location
Services; Made Izat Accelerate Location entry's icon
indicate the user consent status; replaced the full
screen view with a dialog box to prompt user with
Opt In message.

Change-Id: Ie4c58ebf1048b03c0d1443532eca2f2f030cfb21
CRs-Fixed: 929695
parent 07e83099
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_JAVA_LIBRARIES := bouncycastle core-oj telephony-common ims-common
LOCAL_JAVA_LIBRARIES := bouncycastle core-oj telephony-common ims-common izat.xt.srv
LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-v4 \
    android-support-v13 \
+2 −0
Original line number Diff line number Diff line
@@ -2998,6 +2998,8 @@
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>

        <uses-library android:name="izat.xt.srv"/>
        <!-- This is the longest AndroidManifest.xml ever. -->
    </application>
</manifest>
+4 −4
Original line number Diff line number Diff line
@@ -34,12 +34,12 @@
            android:enabled="false"
            android:selectable="true" />

        <com.android.settings.DividedCategory
            android:key="recent_location_requests"
            android:title="@string/location_category_recent_location_requests" />

        <PreferenceCategory
            android:key="location_services"
            android:title="@string/location_category_location_services" />

        <com.android.settings.DividedCategory
            android:key="recent_location_requests"
            android:title="@string/location_category_recent_location_requests" />

</PreferenceScreen>
+7 −1
Original line number Diff line number Diff line
@@ -41,6 +41,12 @@ public class DimmableIconPreference extends RestrictedPreference {
        this(context, (AttributeSet) null);
    }

    public DimmableIconPreference(Context context, AttributeSet attrs, int defStyleAttr,
                                  @Nullable CharSequence contentDescription) {
        super(context, attrs, defStyleAttr);
        mContentDescription = contentDescription;
    }

    public DimmableIconPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContentDescription = null;
@@ -53,7 +59,7 @@ public class DimmableIconPreference extends RestrictedPreference {
        useAdminDisabledSummary(true);
    }

    private void dimIcon(boolean dimmed) {
    protected void dimIcon(boolean dimmed) {
        Drawable icon = getIcon();
        if (icon != null) {
            icon.mutate().setAlpha(dimmed ? ICON_ALPHA_DISABLED : ICON_ALPHA_ENABLED);
+75 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of The Linux Foundation nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

package com.android.settings.location;

import android.annotation.Nullable;
import android.content.Context;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.util.Log;
import com.android.settings.DimmableIconPreference;
import com.qti.izat.XTProxy;
import com.qti.izat.IXTSrvCb;

public class DimmableIZatIconPreference extends DimmableIconPreference {
    private static final String TAG = "DimmableIZatIconPreference";
    boolean mChecked;
    private XTProxy mXT;

    public static DimmableIconPreference newInstance(Context context,
            @Nullable CharSequence contentDescription, InjectedSetting info) {
        if (XTProxy.IZAT_XT_PACKAGE.equals(info.packageName)) {
            return new DimmableIZatIconPreference(context, null,
                           com.android.internal.R.attr.checkBoxPreferenceStyle);
        } else {
            return new DimmableIconPreference(context, contentDescription);
        }
    }

    public DimmableIZatIconPreference(Context context, AttributeSet attrs,
                                          int defStyleAttr) {
        super(context, attrs, defStyleAttr, null);

        mXT = XTProxy.getXTProxy(context, new IXTSrvCb.Stub() {
            @Override
            public void userConsentNotify(boolean consent) {
                if (mChecked != mXT.getUserConsent()) {
                    mChecked = !mChecked;
                    dimIcon(!isEnabled() || !mChecked);
                }
            }
        });
        mChecked = mXT.getUserConsent();
    }

    @Override
    public void onBindViewHolder(PreferenceViewHolder view) {
        super.onBindViewHolder(view);
        dimIcon(!isEnabled() || !mChecked);
    }
}
Loading