<commit_before>package uz.efir.muazzin;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;

import islam.adhanalarm.widget.NextNotificationWidgetProvider;
import islam.adhanalarm.widget.TimetableWidgetProvider;

/*
 * Following alarm clock intent implementation is adapted from
 *     <a href="https://code.google.com/p/dashclock/">DashClock</a>
 *
 * Copyright 2013 Google Inc.
 *
 * 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.
 */

public class Utils {
    private static final String[] CLOCK_PACKAGES = new String[] {
        "com.google.android.deskclock", // Google's
        "com.android.deskclock", // AOSP's
        "com.sec.android.app.clockpackage" // Samsung's
    };
    private static final String DEFAULT_ALARM_ACTIVITY = "com.android.deskclock.AlarmClock";
    private static boolean mIsForeground = false;
    public static boolean isRestartNeeded = false;

    public static Intent getDefaultAlarmsIntent(Context context) {
        PackageManager pm = context.getPackageManager();
        for (String packageName : CLOCK_PACKAGES) {
            try {
                ComponentName cn = new ComponentName(packageName, DEFAULT_ALARM_ACTIVITY);
                pm.getActivityInfo(cn, 0);
                Intent intent = new Intent(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_LAUNCHER);
                intent.setComponent(cn);
                return intent;
            } catch (PackageManager.NameNotFoundException ignored) {
            }
        }

        // DEFAULT_ALARM_ACTIVITY is not found, launch the main app
        for (String packageName : CLOCK_PACKAGES) {<commit_msg>Add intent extra for Deskclock<commit_after>package uz.efir.muazzin;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import islam.adhanalarm.widget.NextNotificationWidgetProvider;
import islam.adhanalarm.widget.TimetableWidgetProvider;

/*
 * Following alarm clock intent implementation is adapted from
 *     <a href="https://code.google.com/p/dashclock/">DashClock</a>
 *
 * Copyright 2013 Google Inc.
 *
 * 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.
 */

public class Utils {
    private static final String[] DESK_CLOCK_PACKAGES = new String[] {
            "com.google.android.deskclock", // Google's
            "com.android.deskclock", // AOSP's
    };
    private static final String[] OTHER_CLOCK_PACKAGES = new String[] {
            "com.sec.android.app.clockpackage" // Samsung's
    };
    private static final String SELECT_TAB_INTENT_EXTRA = "deskclock.select.tab";
    private static final String DEFAULT_ALARM_ACTIVITY = "com.android.deskclock.AlarmClock";
    private static boolean mIsForeground = false;
    public static boolean isRestartNeeded = false;

    public static Intent getDefaultAlarmsIntent(Context context) {
        PackageManager pm = context.getPackageManager();
        for (String packageName : DESK_CLOCK_PACKAGES) {
            try {
                PackageInfo pi = pm.getPackageInfo(packageName, 0);
                if (302 >= pi.versionCode) {
                    Intent intent = pm.getLaunchIntentForPackage(packageName);
                    intent.putExtra(SELECT_TAB_INTENT_EXTRA, 0);
                    return intent;
                }
                ComponentName cn = new ComponentName(packageName, DEFAULT_ALARM_ACTIVITY);
                pm.getActivityInfo(cn, 0);
                Intent intent = new Intent(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_LAUNCHER);
                intent.setComponent(cn);
                return intent;
            } catch (PackageManager.NameNotFoundException ignored) {
            }
        }

        // None worked, try others
        for (String packageName : OTHER_CLOCK_PACKAGES) {
{'fraction_non_alphanumeric': 0.08323281061519903, 'fraction_numerical': 0.004624045034177724, 'mean_word_length': 2.9484126984126986, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1680555', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1293, 'n_words': 391}