diff options
author | Nick Chalko <nchalko@google.com> | 2020-01-03 10:57:25 -0800 |
---|---|---|
committer | Nick Chalko <nchalko@google.com> | 2020-01-03 12:09:10 -0800 |
commit | a2889f9e4e08f46cfa59dbe290241cd0311a2bcb (patch) | |
tree | b82cb72daf24253ddc1c8c79d68d3854ad80d6cc /src/com | |
parent | c5e34b4f53f0109b6feedf7a5745cf0afc4a06d0 (diff) | |
download | TV-a2889f9e4e08f46cfa59dbe290241cd0311a2bcb.tar.gz |
Remove unneeded analytics updater.
PiperOrigin-RevId: 288016691
Change-Id: If7e48dce1d5be97699369c4fd395e302667897a4
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/tv/MainActivity.java | 27 | ||||
-rw-r--r-- | src/com/android/tv/analytics/SendChannelStatusRunnable.java | 111 | ||||
-rw-r--r-- | src/com/android/tv/analytics/SendConfigInfoRunnable.java | 49 |
3 files changed, 1 insertions, 186 deletions
diff --git a/src/com/android/tv/MainActivity.java b/src/com/android/tv/MainActivity.java index ffef9642..2ae64092 100644 --- a/src/com/android/tv/MainActivity.java +++ b/src/com/android/tv/MainActivity.java @@ -70,8 +70,6 @@ import android.widget.FrameLayout; import android.widget.Toast; import com.android.tv.MainActivity.MySingletons; -import com.android.tv.analytics.SendChannelStatusRunnable; -import com.android.tv.analytics.SendConfigInfoRunnable; import com.android.tv.analytics.Tracker; import com.android.tv.audio.AudioManagerHelper; import com.android.tv.audiotvservice.AudioOnlyTvServiceUtil; @@ -152,7 +150,6 @@ import com.android.tv.util.AsyncDbTask; import com.android.tv.util.AsyncDbTask.DbExecutor; import com.android.tv.util.CaptionSettings; import com.android.tv.util.OnboardingUtils; -import com.android.tv.util.RecurringRunner; import com.android.tv.util.SetupUtils; import com.android.tv.util.TvInputManagerHelper; import com.android.tv.util.TvSettings; @@ -363,9 +360,6 @@ public class MainActivity extends Activity private static final int MAX_RECENT_CHANNELS = 5; private final ArrayDeque<Long> mRecentChannels = new ArrayDeque<>(MAX_RECENT_CHANNELS); - private RecurringRunner mSendConfigInfoRecurringRunner; - private RecurringRunner mChannelStatusRecurringRunner; - private String mLastInputIdFromIntent; private final Handler mHandler = new MainActivityHandler(this); @@ -726,17 +720,6 @@ public class MainActivity extends Activity return; } - mSendConfigInfoRecurringRunner = - new RecurringRunner( - this, - TimeUnit.DAYS.toMillis(1), - new SendConfigInfoRunnable(mTracker, mTvInputManagerHelper), - null); - mSendConfigInfoRecurringRunner.start(); - mChannelStatusRecurringRunner = - SendChannelStatusRunnable.startChannelStatusRecurringRunner( - this, mTracker, mChannelDataManager); - if (CommonFeatures.DVR.isEnabled(this) && TvFeatures.SHOW_UPCOMING_CONFLICT_DIALOG.isEnabled(this)) { mDvrConflictChecker = new ConflictChecker(this); @@ -2042,14 +2025,6 @@ public class MainActivity extends Activity } mHandler.removeCallbacksAndMessages(null); application.getMainActivityWrapper().onMainActivityDestroyed(this); - if (mSendConfigInfoRecurringRunner != null) { - mSendConfigInfoRecurringRunner.stop(); - mSendConfigInfoRecurringRunner = null; - } - if (mChannelStatusRecurringRunner != null) { - mChannelStatusRecurringRunner.stop(); - mChannelStatusRecurringRunner = null; - } if (mTvInputManagerHelper != null) { mTvInputManagerHelper.clearTvInputLabels(); if (mOptionalBuiltInTunerManager.isPresent()) { @@ -2586,7 +2561,7 @@ public class MainActivity extends Activity // 2. System language captions // 3. Other captions int index = UNDEFINED_TRACK_INDEX; - for (int j = 0; j < preferredLanguages.size() ; j++) { + for (int j = 0; j < preferredLanguages.size(); j++) { if (Utils.isEqualLanguage(track.getLanguage(), preferredLanguages.get(j))) { index = j; break; diff --git a/src/com/android/tv/analytics/SendChannelStatusRunnable.java b/src/com/android/tv/analytics/SendChannelStatusRunnable.java deleted file mode 100644 index 306bd855..00000000 --- a/src/com/android/tv/analytics/SendChannelStatusRunnable.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.tv.analytics; - -import android.content.Context; -import android.os.Handler; -import android.os.Looper; -import android.support.annotation.MainThread; -import com.android.tv.data.ChannelDataManager; -import com.android.tv.data.api.Channel; -import com.android.tv.util.RecurringRunner; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Periodically sends analytics data with the channel count. - * - * <p> - * - * <p>This should only be started from a user activity like {@link com.android.tv.MainActivity}. - */ -@MainThread -public class SendChannelStatusRunnable implements Runnable { - private static final long SEND_CHANNEL_STATUS_INTERVAL_MS = TimeUnit.DAYS.toMillis(1); - - public static RecurringRunner startChannelStatusRecurringRunner( - Context context, Tracker tracker, ChannelDataManager channelDataManager) { - - final SendChannelStatusRunnable sendChannelStatusRunnable = - new SendChannelStatusRunnable(channelDataManager, tracker); - - Runnable onStopRunnable = () -> sendChannelStatusRunnable.setDbLoadListener(null); - final RecurringRunner recurringRunner = - new RecurringRunner( - context, - SEND_CHANNEL_STATUS_INTERVAL_MS, - sendChannelStatusRunnable, - onStopRunnable); - - if (channelDataManager.isDbLoadFinished()) { - sendChannelStatusRunnable.setDbLoadListener(null); - recurringRunner.start(); - } else { - // Start the recurring runnable after the channel DB is finished loading. - sendChannelStatusRunnable.setDbLoadListener( - new ChannelDataManager.Listener() { - @Override - public void onLoadFinished() { - // This is called inside an iterator of Listeners so the remove step is - // done - // via a post on the main thread - new Handler(Looper.getMainLooper()) - .post(() -> sendChannelStatusRunnable.setDbLoadListener(null)); - recurringRunner.start(); - } - - @Override - public void onChannelListUpdated() {} - - @Override - public void onChannelBrowsableChanged() {} - }); - } - return recurringRunner; - } - - private final ChannelDataManager mChannelDataManager; - private final Tracker mTracker; - private ChannelDataManager.Listener mListener; - - private SendChannelStatusRunnable(ChannelDataManager channelDataManager, Tracker tracker) { - mChannelDataManager = channelDataManager; - mTracker = tracker; - } - - @Override - public void run() { - int browsableChannelCount = 0; - List<Channel> channelList = mChannelDataManager.getChannelList(); - for (Channel channel : channelList) { - if (channel.isBrowsable()) { - ++browsableChannelCount; - } - } - mTracker.sendChannelCount(browsableChannelCount, channelList.size()); - } - - private void setDbLoadListener(ChannelDataManager.Listener listener) { - if (mListener != null) { - mChannelDataManager.removeListener(mListener); - } - mListener = listener; - if (listener != null) { - mChannelDataManager.addListener(listener); - } - } -} diff --git a/src/com/android/tv/analytics/SendConfigInfoRunnable.java b/src/com/android/tv/analytics/SendConfigInfoRunnable.java deleted file mode 100644 index d4674086..00000000 --- a/src/com/android/tv/analytics/SendConfigInfoRunnable.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2015 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.tv.analytics; - -import android.media.tv.TvInputInfo; -import com.android.tv.util.TvInputManagerHelper; -import java.util.List; - -/** Sends ConfigurationInfo once a day. */ -public class SendConfigInfoRunnable implements Runnable { - private final Tracker mTracker; - private final TvInputManagerHelper mTvInputManagerHelper; - - public SendConfigInfoRunnable(Tracker tracker, TvInputManagerHelper tvInputManagerHelper) { - this.mTracker = tracker; - this.mTvInputManagerHelper = tvInputManagerHelper; - } - - @Override - public void run() { - List<TvInputInfo> infoList = mTvInputManagerHelper.getTvInputInfos(false, false); - int systemInputCount = 0; - int nonSystemInputCount = 0; - for (TvInputInfo info : infoList) { - if (mTvInputManagerHelper.isSystemInput(info)) { - systemInputCount++; - } else { - nonSystemInputCount++; - } - } - ConfigurationInfo configurationInfo = - new ConfigurationInfo(systemInputCount, nonSystemInputCount); - mTracker.sendConfigurationInfo(configurationInfo); - } -} |