text:
.class public Lcom/android/server/notification/ValidateNotificationPeople;
.super Ljava/lang/Object;
.source "ValidateNotificationPeople.java"

# interfaces
.implements Lcom/android/server/notification/NotificationSignalExtractor;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;,
        Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;
    }
.end annotation

# static fields
.field private static final DEBUG:Z

.field private static final ENABLE_PEOPLE_VALIDATOR:Z = true

.field private static final LOOKUP_PROJECTION:[Ljava/lang/String;

.field private static final MAX_PEOPLE:I = 0xa

.field static final NONE:F = 0.0f

.field private static final PEOPLE_CACHE_SIZE:I = 0xc8

.field private static final SETTING_ENABLE_PEOPLE_VALIDATOR:Ljava/lang/String; = "validate_notification_people_enabled"

.field static final STARRED_CONTACT:F = 1.0f

.field private static final TAG:Ljava/lang/String; = "ValidateNoPeople"

.field static final VALID_CONTACT:F = 0.5f

.field private static final VERBOSE:Z

# instance fields
.field private mBaseContext:Landroid/content/Context;

.field protected mEnabled:Z

.field private mEvictionCount:I

.field private mHandler:Landroid/os/Handler;

.field private mObserver:Landroid/database/ContentObserver;

.field private mPeopleCache:Landroid/util/LruCache;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/LruCache",
            "<",
            "Ljava/lang/String;",
            "Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;",
            ">;"
        }
    .end annotation
.end field

.field private mUsageStats:Lcom/android/server/notification/NotificationUsageStats;

.field private mUserToContextMap:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/Integer;",
            "Landroid/content/Context;",
            ">;"
        }
    .end annotation
.end field

# direct methods
.method static synthetic -get0()Z
    .locals 1

    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->DEBUG:Z

    return v0
.end method

.method static synthetic -get1()Z
    .locals 1

    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    return v0
.end method

.method static synthetic -get2(Lcom/android/server/notification/ValidateNotificationPeople;)I
    .locals 1

    iget v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mEvictionCount:I

    return v0
.end method

.method static synthetic -get3(Lcom/android/server/notification/ValidateNotificationPeople;)Landroid/util/LruCache;
    .locals 1

    iget-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mPeopleCache:Landroid/util/LruCache;

    return-object v0
.end method

.method static synthetic -get4(Lcom/android/server/notification/ValidateNotificationPeople;)Lcom/android/server/notification/NotificationUsageStats;
    .locals 1

    iget-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mUsageStats:Lcom/android/server/notification/NotificationUsageStats;

    return-object v0
.end method

.method static synthetic -set0(Lcom/android/server/notification/ValidateNotificationPeople;I)I
    .locals 0

    iput p1, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mEvictionCount:I

    return p1
.end method

.method static synthetic -wrap0(Lcom/android/server/notification/ValidateNotificationPeople;Landroid/content/Context;Ljava/lang/String;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    .locals 1
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "email"    # Ljava/lang/String;

    .prologue
    invoke-direct {p0, p1, p2}, Lcom/android/server/notification/ValidateNotificationPeople;->resolveEmailContact(Landroid/content/Context;Ljava/lang/String;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    move-result-object v0

    return-object v0
.end method

.method static synthetic -wrap1(Lcom/android/server/notification/ValidateNotificationPeople;Landroid/content/Context;Ljava/lang/String;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    .locals 1
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "number"    # Ljava/lang/String;

    .prologue
    invoke-direct {p0, p1, p2}, Lcom/android/server/notification/ValidateNotificationPeople;->resolvePhoneContact(Landroid/content/Context;Ljava/lang/String;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    move-result-object v0

    return-object v0
.end method

.method static synthetic -wrap2(Lcom/android/server/notification/ValidateNotificationPeople;Landroid/content/Context;Landroid/net/Uri;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    .locals 1
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "lookupUri"    # Landroid/net/Uri;

    .prologue
    invoke-direct {p0, p1, p2}, Lcom/android/server/notification/ValidateNotificationPeople;->searchContacts(Landroid/content/Context;Landroid/net/Uri;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    move-result-object v0

    return-object v0
.end method

.method static synthetic -wrap3(Lcom/android/server/notification/ValidateNotificationPeople;ILjava/lang/String;)Ljava/lang/String;
    .locals 1
    .param p1, "userId"    # I
    .param p2, "handle"    # Ljava/lang/String;

    .prologue
    invoke-direct {p0, p1, p2}, Lcom/android/server/notification/ValidateNotificationPeople;->getCacheKey(ILjava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static constructor <clinit>()V
    .locals 3

    .prologue
    const/4 v2, 0x2

    .line 53
    const-string/jumbo v0, "ValidateNoPeople"

    invoke-static {v0, v2}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z

    move-result v0

    sput-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    .line 54
    const-string/jumbo v0, "ValidateNoPeople"

    const/4 v1, 0x3

    invoke-static {v0, v1}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z

    move-result v0

    sput-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->DEBUG:Z

    .line 59
    new-array v0, v2, [Ljava/lang/String;

    const-string/jumbo v1, "_id"

    const/4 v2, 0x0

    aput-object v1, v0, v2

    const-string/jumbo v1, "starred"

    const/4 v2, 0x1

    aput-object v1, v0, v2

    sput-object v0, Lcom/android/server/notification/ValidateNotificationPeople;->LOOKUP_PROJECTION:[Ljava/lang/String;

    .line 50
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 50
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private getCacheKey(ILjava/lang/String;)Ljava/lang/String;
    .locals 2
    .param p1, "userId"    # I
    .param p2, "handle"    # Ljava/lang/String;

    .prologue
    .line 264
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-static {p1}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string/jumbo v1, ":"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private getContextAsUser(Landroid/os/UserHandle;)Landroid/content/Context;
    .locals 5
    .param p1, "userHandle"    # Landroid/os/UserHandle;

    .prologue
    .line 190
    iget-object v2, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mUserToContextMap:Ljava/util/Map;

    invoke-virtual {p1}, Landroid/os/UserHandle;->getIdentifier()I

    move-result v3

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-interface {v2, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/Context;

    .line 191
    .local v0, "context":Landroid/content/Context;
    if-nez v0, :cond_0

    .line 193
    :try_start_0
    iget-object v2, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mBaseContext:Landroid/content/Context;

    const-string/jumbo v3, "android"

    const/4 v4, 0x0

    invoke-virtual {v2, v3, v4, p1}, Landroid/content/Context;->createPackageContextAsUser(Ljava/lang/String;ILandroid/os/UserHandle;)Landroid/content/Context;

    move-result-object v0

    .line 194
    iget-object v2, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mUserToContextMap:Ljava/util/Map;

    invoke-virtual {p1}, Landroid/os/UserHandle;->getIdentifier()I

    move-result v3

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-interface {v2, v3, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    .line 199
    :cond_0
    :goto_0
    return-object v0

    .line 195
    :catch_0
    move-exception v1

    .line 196
    .local v1, "e":Landroid/content/pm/PackageManager$NameNotFoundException;
    const-string/jumbo v2, "ValidateNoPeople"

    const-string/jumbo v3, "failed to create package context for lookups"

    invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method

.method public static getExtraPeople(Landroid/os/Bundle;)[Ljava/lang/String;
    .locals 12
    .param p0, "extras"    # Landroid/os/Bundle;

    .prologue
    const/4 v11, 0x0

    const/4 v10, 0x1

    const/4 v9, 0x0

    .line 269
    const-string/jumbo v8, "android.people"

    invoke-virtual {p0, v8}, Landroid/os/Bundle;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v6

    .line 270
    .local v6, "people":Ljava/lang/Object;
    instance-of v8, v6, [Ljava/lang/String;

    if-eqz v8, :cond_0

    .line 271
    check-cast v6, [Ljava/lang/String;

    .end local v6    # "people":Ljava/lang/Object;
    return-object v6

    .line 274
    .restart local v6    # "people":Ljava/lang/Object;
    :cond_0
    instance-of v8, v6, Ljava/util/ArrayList;

    if-eqz v8, :cond_5

    move-object v2, v6

    .line 275
    check-cast v2, Ljava/util/ArrayList;

    .line 277
    .local v2, "arrayList":Ljava/util/ArrayList;
    invoke-virtual {v2}, Ljava/util/ArrayList;->isEmpty()Z

    move-result v8

    if-eqz v8, :cond_1

    .line 278
    return-object v11

    .line 281
    :cond_1
    invoke-virtual {v2, v9}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v8

    instance-of v8, v8, Ljava/lang/String;

    if-eqz v8, :cond_2

    .line 282
    move-object v7, v2

    .line 283
    .local v7, "stringArray":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;"
    invoke-virtual {v7}, Ljava/util/ArrayList;->size()I

    move-result v8

    new-array v8, v8, [Ljava/lang/String;

    invoke-virtual {v7, v8}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;

    move-result-object v8

    check-cast v8, [Ljava/lang/String;

    return-object v8

    .line 286
    .end local v7    # "stringArray":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;"
    :cond_2
    invoke-virtual {v2, v9}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v8

    instance-of v8, v8, Ljava/lang/CharSequence;

    if-eqz v8, :cond_4

    .line 287
    move-object v4, v2

    .line 288
    .local v4, "charSeqList":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/CharSequence;>;"
    invoke-virtual {v4}, Ljava/util/ArrayList;->size()I

    move-result v0

    .line 289
    .local v0, "N":I
    new-array v1, v0, [Ljava/lang/String;

    .line 290
    .local v1, "array":[Ljava/lang/String;
    const/4 v5, 0x0

    .local v5, "i":I
    :goto_0
    if-ge v5, v0, :cond_3

    .line 291
    invoke-virtual {v4, v5}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Ljava/lang/CharSequence;

    invoke-interface {v8}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v8

    aput-object v8, v1, v5

    .line 290
    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    .line 293
    :cond_3
    return-object v1

    .line 296
    .end local v0    # "N":I
    .end local v1    # "array":[Ljava/lang/String;
    .end local v4    # "charSeqList":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/CharSequence;>;"
    .end local v5    # "i":I
    :cond_4
    return-object v11

    .line 299
    .end local v2    # "arrayList":Ljava/util/ArrayList;
    :cond_5
    instance-of v8, v6, Ljava/lang/String;

    if-eqz v8, :cond_6

    .line 300
    new-array v1, v10, [Ljava/lang/String;

    .line 301
    .restart local v1    # "array":[Ljava/lang/String;
    check-cast v6, Ljava/lang/String;

    .end local v6    # "people":Ljava/lang/Object;
    aput-object v6, v1, v9

    .line 302
    return-object v1

    .line 305
    .end local v1    # "array":[Ljava/lang/String;
    .restart local v6    # "people":Ljava/lang/Object;
    :cond_6
    instance-of v8, v6, [C

    if-eqz v8, :cond_7

    .line 306
    new-array v1, v10, [Ljava/lang/String;

    .line 307
    .restart local v1    # "array":[Ljava/lang/String;
    new-instance v8, Ljava/lang/String;

    check-cast v6, [C

    .end local v6    # "people":Ljava/lang/Object;
    invoke-direct {v8, v6}, Ljava/lang/String;-><init>([C)V

    aput-object v8, v1, v9

    .line 308
    return-object v1

    .line 311
    .end local v1    # "array":[Ljava/lang/String;
    .restart local v6    # "people":Ljava/lang/Object;
    :cond_7
    instance-of v8, v6, Ljava/lang/CharSequence;

    if-eqz v8, :cond_8

    .line 312
    new-array v1, v10, [Ljava/lang/String;

    .line 313
    .restart local v1    # "array":[Ljava/lang/String;
    check-cast v6, Ljava/lang/CharSequence;

    .end local v6    # "people":Ljava/lang/Object;
    invoke-interface {v6}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v8

    aput-object v8, v1, v9

    .line 314
    return-object v1

    .line 317
    .end local v1    # "array":[Ljava/lang/String;
    .restart local v6    # "people":Ljava/lang/Object;
    :cond_8
    instance-of v8, v6, [Ljava/lang/CharSequence;

    if-eqz v8, :cond_a

    move-object v3, v6

    .line 318
    check-cast v3, [Ljava/lang/CharSequence;

    .line 319
    .local v3, "charSeqArray":[Ljava/lang/CharSequence;
    array-length v0, v3

    .line 320
    .restart local v0    # "N":I
    new-array v1, v0, [Ljava/lang/String;

    .line 321
    .restart local v1    # "array":[Ljava/lang/String;
    const/4 v5, 0x0

    .restart local v5    # "i":I
    :goto_1
    if-ge v5, v0, :cond_9

    .line 322
    aget-object v8, v3, v5

    invoke-interface {v8}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v8

    aput-object v8, v1, v5

    .line 321
    add-int/lit8 v5, v5, 0x1

    goto :goto_1

    .line 324
    :cond_9
    return-object v1

    .line 327
    .end local v0    # "N":I
    .end local v1    # "array":[Ljava/lang/String;
    .end local v3    # "charSeqArray":[Ljava/lang/CharSequence;
    .end local v5    # "i":I
    :cond_a
    return-object v11
.end method

.method private resolveEmailContact(Landroid/content/Context;Ljava/lang/String;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    .locals 3
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "email"    # Ljava/lang/String;

    .prologue
    .line 338
    sget-object v1, Landroid/provider/ContactsContract$CommonDataKinds$Email;->CONTENT_LOOKUP_URI:Landroid/net/Uri;

    .line 339
    invoke-static {p2}, Landroid/net/Uri;->encode(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 337
    invoke-static {v1, v2}, Landroid/net/Uri;->withAppendedPath(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v0

    .line 340
    .local v0, "numberUri":Landroid/net/Uri;
    invoke-direct {p0, p1, v0}, Lcom/android/server/notification/ValidateNotificationPeople;->searchContacts(Landroid/content/Context;Landroid/net/Uri;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    move-result-object v1

    return-object v1
.end method

.method private resolvePhoneContact(Landroid/content/Context;Ljava/lang/String;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    .locals 3
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "number"    # Ljava/lang/String;

    .prologue
    .line 331
    sget-object v1, Landroid/provider/ContactsContract$PhoneLookup;->CONTENT_FILTER_URI:Landroid/net/Uri;

    .line 332
    invoke-static {p2}, Landroid/net/Uri;->encode(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 331
    invoke-static {v1, v2}, Landroid/net/Uri;->withAppendedPath(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v0

    .line 333
    .local v0, "phoneUri":Landroid/net/Uri;
    invoke-direct {p0, p1, v0}, Lcom/android/server/notification/ValidateNotificationPeople;->searchContacts(Landroid/content/Context;Landroid/net/Uri;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    move-result-object v1

    return-object v1
.end method

.method private searchContacts(Landroid/content/Context;Landroid/net/Uri;)Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    .locals 9
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "lookupUri"    # Landroid/net/Uri;

    .prologue
    .line 344
    new-instance v7, Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    invoke-direct {v7}, Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;-><init>()V

    .line 345
    .local v7, "lookupResult":Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    const/4 v6, 0x0

    .line 347
    .local v6, "c":Landroid/database/Cursor;
    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    sget-object v2, Lcom/android/server/notification/ValidateNotificationPeople;->LOOKUP_PROJECTION:[Ljava/lang/String;

    const/4 v3, 0x0

    const/4 v4, 0x0

    const/4 v5, 0x0

    move-object v1, p2

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 348
    .local v6, "c":Landroid/database/Cursor;
    if-nez v6, :cond_1

    .line 349
    const-string/jumbo v0, "ValidateNoPeople"

    const-string/jumbo v1, "Null cursor from contacts query."

    invoke-static {v0, v1}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 358
    if-eqz v6, :cond_0

    .line 359
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 350
    :cond_0
    return-object v7

    .line 352
    :cond_1
    :goto_0
    :try_start_1
    invoke-interface {v6}, Landroid/database/Cursor;->moveToNext()Z

    move-result v0

    if-eqz v0, :cond_3

    .line 353
    invoke-virtual {v7, v6}, Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;->mergeContact(Landroid/database/Cursor;)V
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 355
    .end local v6    # "c":Landroid/database/Cursor;
    :catch_0
    move-exception v8

    .line 356
    .local v8, "t":Ljava/lang/Throwable;
    :try_start_2
    const-string/jumbo v0, "ValidateNoPeople"

    const-string/jumbo v1, "Problem getting content resolver or performing contacts query."

    invoke-static {v0, v1, v8}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 358
    if-eqz v6, :cond_2

    .line 359
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 362
    .end local v8    # "t":Ljava/lang/Throwable;
    :cond_2
    :goto_1
    return-object v7

    .line 358
    .restart local v6    # "c":Landroid/database/Cursor;
    :cond_3
    if-eqz v6, :cond_2

    .line 359
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    goto :goto_1

    .line 357
    .end local v6    # "c":Landroid/database/Cursor;
    :catchall_0
    move-exception v0

    .line 358
    if-eqz v6, :cond_4

    .line 359
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 357
    :cond_4
    throw v0
.end method

.method private validatePeople(Landroid/content/Context;Lcom/android/server/notification/NotificationRecord;)Lcom/android/server/notification/RankingReconsideration;
    .locals 10
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "record"    # Lcom/android/server/notification/NotificationRecord;

    .prologue
    const/4 v5, 0x0

    const/4 v6, 0x1

    .line 204
    invoke-virtual {p2}, Lcom/android/server/notification/NotificationRecord;->getKey()Ljava/lang/String;

    move-result-object v3

    .line 205
    .local v3, "key":Ljava/lang/String;
    invoke-virtual {p2}, Lcom/android/server/notification/NotificationRecord;->getNotification()Landroid/app/Notification;

    move-result-object v7

    iget-object v2, v7, Landroid/app/Notification;->extras:Landroid/os/Bundle;

    .line 206
    .local v2, "extras":Landroid/os/Bundle;
    new-array v1, v6, [F

    .line 207
    .local v1, "affinityOut":[F
    invoke-direct {p0, p1, v3, v2, v1}, Lcom/android/server/notification/ValidateNotificationPeople;->validatePeople(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;[F)Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;

    move-result-object v4

    .line 208
    .local v4, "rr":Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;
    aget v0, v1, v5

    .line 209
    .local v0, "affinity":F
    invoke-virtual {p2, v0}, Lcom/android/server/notification/NotificationRecord;->setContactAffinity(F)V

    .line 210
    if-nez v4, :cond_2

    .line 211
    iget-object v8, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mUsageStats:Lcom/android/server/notification/NotificationUsageStats;

    const/4 v7, 0x0

    cmpl-float v7, v0, v7

    if-lez v7, :cond_1

    move v7, v6

    :goto_0
    const/high16 v9, 0x3f800000    # 1.0f

    cmpl-float v9, v0, v9

    if-nez v9, :cond_0

    move v5, v6

    :cond_0
    invoke-virtual {v8, p2, v7, v5, v6}, Lcom/android/server/notification/NotificationUsageStats;->registerPeopleAffinity(Lcom/android/server/notification/NotificationRecord;ZZZ)V

    .line 216
    :goto_1
    return-object v4

    :cond_1
    move v7, v5

    .line 211
    goto :goto_0

    .line 214
    :cond_2
    invoke-virtual {v4, p2}, Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;->setRecord(Lcom/android/server/notification/NotificationRecord;)V

    goto :goto_1
.end method

.method private validatePeople(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;[F)Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;
    .locals 12
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "key"    # Ljava/lang/String;
    .param p3, "extras"    # Landroid/os/Bundle;
    .param p4, "affinityOut"    # [F

    .prologue
    .line 221
    const/4 v6, 0x0

    .line 222
    .local v6, "affinity":F
    if-nez p3, :cond_0

    .line 223
    const/4 v0, 0x0

    return-object v0

    .line 226
    :cond_0
    invoke-static {p3}, Lcom/android/server/notification/ValidateNotificationPeople;->getExtraPeople(Landroid/os/Bundle;)[Ljava/lang/String;

    move-result-object v10

    .line 227
    .local v10, "people":[Ljava/lang/String;
    if-eqz v10, :cond_1

    array-length v0, v10

    if-nez v0, :cond_2

    .line 228
    :cond_1
    const/4 v0, 0x0

    return-object v0

    .line 231
    :cond_2
    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    if-eqz v0, :cond_3

    const-string/jumbo v0, "ValidateNoPeople"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "Validating: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string/jumbo v2, " for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {p1}, Landroid/content/Context;->getUserId()I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 232
    :cond_3
    new-instance v4, Ljava/util/LinkedList;

    invoke-direct {v4}, Ljava/util/LinkedList;-><init>()V

    .line 233
    .local v4, "pendingLookups":Ljava/util/LinkedList;, "Ljava/util/LinkedList<Ljava/lang/String;>;"
    const/4 v11, 0x0

    .local v11, "personIdx":I
    :goto_0
    array-length v0, v10

    if-ge v11, v0, :cond_9

    const/16 v0, 0xa

    if-ge v11, v0, :cond_9

    .line 234
    aget-object v8, v10, v11

    .line 235
    .local v8, "handle":Ljava/lang/String;
    invoke-static {v8}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_4

    .line 233
    :goto_1
    add-int/lit8 v11, v11, 0x1

    goto :goto_0

    .line 237
    :cond_4
    iget-object v1, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mPeopleCache:Landroid/util/LruCache;

    monitor-enter v1

    .line 238
    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getUserId()I

    move-result v0

    invoke-direct {p0, v0, v8}, Lcom/android/server/notification/ValidateNotificationPeople;->getCacheKey(ILjava/lang/String;)Ljava/lang/String;

    move-result-object v7

    .line 239
    .local v7, "cacheKey":Ljava/lang/String;
    iget-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mPeopleCache:Landroid/util/LruCache;

    invoke-virtual {v0, v7}, Landroid/util/LruCache;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v9

    check-cast v9, Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;

    .line 240
    .local v9, "lookupResult":Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    if-eqz v9, :cond_5

    invoke-static {v9}, Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;->-wrap0(Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;)Z

    move-result v0

    if-eqz v0, :cond_8

    .line 241
    :cond_5
    invoke-virtual {v4, v8}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z

    .line 245
    :cond_6
    :goto_2
    if-eqz v9, :cond_7

    .line 246
    invoke-virtual {v9}, Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;->getAffinity()F

    move-result v0

    invoke-static {v6, v0}, Ljava/lang/Math;->max(FF)F
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v6

    :cond_7
    monitor-exit v1

    goto :goto_1

    .line 243
    :cond_8
    :try_start_1
    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->DEBUG:Z

    if-eqz v0, :cond_6

    const-string/jumbo v0, "ValidateNoPeople"

    const-string/jumbo v2, "using cached lookupResult"

    invoke-static {v0, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_2

    .line 237
    .end local v7    # "cacheKey":Ljava/lang/String;
    .end local v9    # "lookupResult":Lcom/android/server/notification/ValidateNotificationPeople$LookupResult;
    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0

    .line 252
    .end local v8    # "handle":Ljava/lang/String;
    :cond_9
    const/4 v0, 0x0

    aput v6, p4, v0

    .line 254
    invoke-virtual {v4}, Ljava/util/LinkedList;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_b

    .line 255
    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    if-eqz v0, :cond_a

    const-string/jumbo v0, "ValidateNoPeople"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "final affinity: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v6}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 256
    :cond_a
    const/4 v0, 0x0

    return-object v0

    .line 259
    :cond_b
    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->DEBUG:Z

    if-eqz v0, :cond_c

    const-string/jumbo v0, "ValidateNoPeople"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "Pending: future work scheduled for: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 260
    :cond_c
    new-instance v0, Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;

    const/4 v5, 0x0

    move-object v1, p0

    move-object v2, p1

    move-object v3, p2

    invoke-direct/range {v0 .. v5}, Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;-><init>(Lcom/android/server/notification/ValidateNotificationPeople;Landroid/content/Context;Ljava/lang/String;Ljava/util/LinkedList;Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;)V

    return-object v0
.end method

# virtual methods
.method public getContactAffinity(Landroid/os/UserHandle;Landroid/os/Bundle;IF)F
    .locals 10
    .param p1, "userHandle"    # Landroid/os/UserHandle;
    .param p2, "extras"    # Landroid/os/Bundle;
    .param p3, "timeoutMs"    # I
    .param p4, "timeoutAffinity"    # F

    .prologue
    .line 149
    sget-boolean v7, Lcom/android/server/notification/ValidateNotificationPeople;->DEBUG:Z

    if-eqz v7, :cond_0

    const-string/jumbo v7, "ValidateNoPeople"

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v9, "checking affinity for "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 150
    :cond_0
    if-nez p2, :cond_1

    const/4 v7, 0x0

    return v7

    .line 151
    :cond_1
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v8

    invoke-static {v8, v9}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v4

    .line 152
    .local v4, "key":Ljava/lang/String;
    const/4 v7, 0x1

    new-array v1, v7, [F

    .line 153
    .local v1, "affinityOut":[F
    invoke-direct {p0, p1}, Lcom/android/server/notification/ValidateNotificationPeople;->getContextAsUser(Landroid/os/UserHandle;)Landroid/content/Context;

    move-result-object v2

    .line 154
    .local v2, "context":Landroid/content/Context;
    if-nez v2, :cond_2

    .line 155
    const/4 v7, 0x0

    return v7

    .line 157
    :cond_2
    invoke-direct {p0, v2, v4, p2, v1}, Lcom/android/server/notification/ValidateNotificationPeople;->validatePeople(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;[F)Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;

    move-result-object v5

    .line 158
    .local v5, "prr":Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;
    const/4 v7, 0x0

    aget v0, v1, v7

    .line 160
    .local v0, "affinity":F
    if-eqz v5, :cond_4

    .line 163
    new-instance v6, Ljava/util/concurrent/Semaphore;

    const/4 v7, 0x0

    invoke-direct {v6, v7}, Ljava/util/concurrent/Semaphore;-><init>(I)V

    .line 164
    .local v6, "s":Ljava/util/concurrent/Semaphore;
    sget-object v7, Landroid/os/AsyncTask;->THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;

    new-instance v8, Lcom/android/server/notification/ValidateNotificationPeople$2;

    invoke-direct {v8, p0, v5, v6}, Lcom/android/server/notification/ValidateNotificationPeople$2;-><init>(Lcom/android/server/notification/ValidateNotificationPeople;Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;Ljava/util/concurrent/Semaphore;)V

    invoke-interface {v7, v8}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V

    .line 173
    int-to-long v8, p3

    :try_start_0
    sget-object v7, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    invoke-virtual {v6, v8, v9, v7}, Ljava/util/concurrent/Semaphore;->tryAcquire(JLjava/util/concurrent/TimeUnit;)Z

    move-result v7

    if-nez v7, :cond_3

    .line 174
    const-string/jumbo v7, "ValidateNoPeople"

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v9, "Timeout while waiting for affinity: "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string/jumbo v9, ". "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 175
    const-string/jumbo v9, "Returning timeoutAffinity="

    .line 174
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, p4}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    .line 176
    return p4

    .line 178
    :catch_0
    move-exception v3

    .line 179
    .local v3, "e":Ljava/lang/InterruptedException;
    const-string/jumbo v7, "ValidateNoPeople"

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v9, "InterruptedException while waiting for affinity: "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string/jumbo v9, ". "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 180
    const-string/jumbo v9, "Returning affinity="

    .line 179
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8, v0}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 181
    return v0

    .line 184
    .end local v3    # "e":Ljava/lang/InterruptedException;
    :cond_3
    invoke-virtual {v5}, Lcom/android/server/notification/ValidateNotificationPeople$PeopleRankingReconsideration;->getContactAffinity()F

    move-result v7

    invoke-static {v7, v0}, Ljava/lang/Math;->max(FF)F

    move-result v0

    .line 186
    .end local v6    # "s":Ljava/util/concurrent/Semaphore;
    :cond_4
    return v0
.end method

.method public initialize(Landroid/content/Context;Lcom/android/server/notification/NotificationUsageStats;)V
    .locals 5
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "usageStats"    # Lcom/android/server/notification/NotificationUsageStats;

    .prologue
    const/4 v1, 0x1

    .line 90
    sget-boolean v0, Lcom/android/server/notification/ValidateNotificationPeople;->DEBUG:Z

    if-eqz v0, :cond_0

    const-string/jumbo v0, "ValidateNoPeople"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v3, "Initializing  "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {p0}, Lcom/android/server/notification/ValidateNotificationPeople;->getClass()Ljava/lang/Class;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string/jumbo v3, "."

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 91
    :cond_0
    new-instance v0, Landroid/util/ArrayMap;

    invoke-direct {v0}, Landroid/util/ArrayMap;-><init>()V

    iput-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mUserToContextMap:Ljava/util/Map;

    .line 92
    iput-object p1, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mBaseContext:Landroid/content/Context;

    .line 93
    iput-object p2, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mUsageStats:Lcom/android/server/notification/NotificationUsageStats;

    .line 94
    new-instance v0, Landroid/util/LruCache;

    const/16 v2, 0xc8

    invoke-direct {v0, v2}, Landroid/util/LruCache;-><init>(I)V

    iput-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mPeopleCache:Landroid/util/LruCache;

    .line 96
    iget-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mBaseContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string/jumbo v2, "validate_notification_people_enabled"

    .line 95
    invoke-static {v0, v2, v1}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v0

    if-ne v1, v0, :cond_2

    move v0, v1

    :goto_0
    iput-boolean v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mEnabled:Z

    .line 97
    iget-boolean v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mEnabled:Z

    if-eqz v0, :cond_1

    .line 98
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mHandler:Landroid/os/Handler;

    .line 99
    new-instance v0, Lcom/android/server/notification/ValidateNotificationPeople$1;

    iget-object v2, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mHandler:Landroid/os/Handler;

    invoke-direct {v0, p0, v2}, Lcom/android/server/notification/ValidateNotificationPeople$1;-><init>(Lcom/android/server/notification/ValidateNotificationPeople;Landroid/os/Handler;)V

    iput-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mObserver:Landroid/database/ContentObserver;

    .line 110
    iget-object v0, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mBaseContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    sget-object v2, Landroid/provider/ContactsContract$Contacts;->CONTENT_URI:Landroid/net/Uri;

    .line 111
    iget-object v3, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mObserver:Landroid/database/ContentObserver;

    const/4 v4, -0x1

    .line 110
    invoke-virtual {v0, v2, v1, v3, v4}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

    .line 89
    :cond_1
    return-void

    .line 95
    :cond_2
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public process(Lcom/android/server/notification/NotificationRecord;)Lcom/android/server/notification/RankingReconsideration;
    .locals 4
    .param p1, "record"    # Lcom/android/server/notification/NotificationRecord;

    .prologue
    const/4 v3, 0x0

    .line 116
    iget-boolean v1, p0, Lcom/android/server/notification/ValidateNotificationPeople;->mEnabled:Z

    if-nez v1, :cond_1

    .line 117
    sget-boolean v1, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    if-eqz v1, :cond_0

    const-string/jumbo v1, "ValidateNoPeople"

    const-string/jumbo v2, "disabled"

    invoke-static {v1, v2}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 118
    :cond_0
    return-object v3

    .line 120
    :cond_1
    if-eqz p1, :cond_2

    invoke-virtual {p1}, Lcom/android/server/notification/NotificationRecord;->getNotification()Landroid/app/Notification;

    move-result-object v1

    if-nez v1, :cond_4

    .line 121
    :cond_2
    sget-boolean v1, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    if-eqz v1, :cond_3

    const-string/jumbo v1, "ValidateNoPeople"

    const-string/jumbo v2, "skipping empty notification"

    invoke-static {v1, v2}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 122
    :cond_3
    return-object v3

    .line 124
    :cond_4
    invoke-virtual {p1}, Lcom/android/server/notification/NotificationRecord;->getUserId()I

    move-result v1

    const/4 v2, -0x1

    if-ne v1, v2, :cond_6

    .line 125
    sget-boolean v1, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    if-eqz v1, :cond_5

    const-string/jumbo v1, "ValidateNoPeople"

    const-string/jumbo v2, "skipping global notification"

    invoke-static {v1, v2}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 126
    :cond_5
    return-object v3

    .line 128
    :cond_6
    invoke-virtual {p1}, Lcom/android/server/notification/NotificationRecord;->getUser()Landroid/os/UserHandle;

    move-result-object v1

    invoke-direct {p0, v1}, Lcom/android/server/notification/ValidateNotificationPeople;->getContextAsUser(Landroid/os/UserHandle;)Landroid/content/Context;

    move-result-object v0

    .line 129
    .local v0, "context":Landroid/content/Context;
    if-nez v0, :cond_8

    .line 130
    sget-boolean v1, Lcom/android/server/notification/ValidateNotificationPeople;->VERBOSE:Z

    if-eqz v1, :cond_7

    const-string/jumbo v1, "ValidateNoPeople"

    const-string/jumbo v2, "skipping notification that lacks a context"

    invoke-static {v1, v2}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 131
    :cond_7
    return-object v3

    .line 133
    :cond_8
    invoke-direct {p0, v0, p1}, Lcom/android/server/notification/ValidateNotificationPeople;->validatePeople(Landroid/content/Context;Lcom/android/server/notification/NotificationRecord;)Lcom/android/server/notification/RankingReconsideration;

    move-result-object v1

    return-object v1
.end method

.method public setConfig(Lcom/android/server/notification/RankingConfig;)V
    .locals 0
    .param p1, "config"    # Lcom/android/server/notification/RankingConfig;

    .prologue
    .line 137
    return-void
.end method


text:
'use strict';

angular.module('tinygraphs.holder', [
  'tinygraphs.holder.holder-directive'
])

.value('version', '0.0.3 Running Free');

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 *  DB.php - class for database connections, queries, etc
 */

class DB
{
    public $dbConn = null;
    public $dbConfig = [
        'host' => '',
        'port' => 0,
        'username' => '',
        'password' => '',
        'dbName' => ''
    ];
    public $dbQueryOptions = [
        'query' => '',
        'optionVals' => []
    ];

    public function __construct($host = '127.0.0.1', $port = 3306, $dbName = 'inquisition',
                                $username = 'inquisition', $password = '')
    {
        $this->dbConfig['host'] = $host;
        $this->dbConfig['port'] = $port;
        $this->dbConfig['dbName'] = $dbName;
        $this->dbConfig['username'] = $username;
        $this->dbConfig['password'] = $password;

        # try connecting to db
        $this->connectToDb();
    }

    public function connectToDb()
    {
        /*
         *  Purpose: create db connection using stored info
         *
         *  Params: NONE
         *
         *  Returns: NONE
         *
         *  Addl. Info: uses PDO library
         *
         */

        $opts = [
            \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
            \PDO::ATTR_EMULATE_PREPARES => false
        ];

        // create DSN
        $dsn = 'mysql:host='.$this->dbConfig['host'].';dbname='.$this->dbConfig['dbName'].';port='
            .$this->dbConfig['port'].';charset=utf8';

        // try connecting
        $this->dbConn = new \PDO($dsn, $this->dbConfig['username'], $this->dbConfig['password'], $opts);
    }

    public function getColumnNamesOfTable($tblName)
    {
        /*
         *  Purpose: get list of column names for given table
         *
         *  Params:
         *      * $tblName :: STR :: name of table to list column names for
         *
         *  Returns: ARRAY
         *
         *  Addl. Info: ** DO NOT use this with untrusted data as the table name as this value is not escaped before
         *      running the query **
         *
         */

        $dbStmt = $this->dbConn->prepare("DESCRIBE ".$tblName);
        $dbStmt->execute();
        $fieldList = $dbStmt->fetchAll(PDO::FETCH_COLUMN);

        return $fieldList;
    }

    public function runQuery($queryType = 'select')
    {
        /*
         *  Purpose: run query with option values using db conn
         *
         *  Params:
         *      * $queryType :: STR :: type of query being ran (changes how results are returned)
         *
         *  Returns: ARRAY or BOOL
         *
         */

        $dbStmt = $this->dbConn->prepare($this->dbQueryOptions['query']);
        if($dbStmt->execute($this->dbQueryOptions['optionVals']) === true)
        {
            if(strtolower($queryType) === 'select')
            {
                return $dbStmt->fetchAll(\PDO::FETCH_ASSOC);
            }
            elseif($queryType === 'insert')
            {
                return [ 'id' => $this->dbConn->lastInsertId() ];
            }
            else
            {
                return true;
            }
        }
        else
        {
            return false;
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
North American Species of Lactarius (Ann Arbor) 331 (1979)

#### Original name
Lactarius californiensis Hesler & A.H. Sm.

### Remarks
null


text:
<?php

use Cake\Core\Configure;

// try to Load the bitly config
try {
    Configure::load('bitly');
} catch (\Cake\Core\Exception\Exception $e) {
    throw new \FrankFoerster\Bitly\Exception\MissingConfigurationFileException();
}


text:
/* CSS for forms pages
** @author Daryl Lim
*/
html {
  font-family: "Berlin Sans FB", "Ropa Sans";
}

.modal{
	padding-top:15%;
}

.error{
	color: red;
}

.btn-primary, .btn-primary:active{
	background-color: #15cdda;
	border-color: transparent;
	}

.btn-primary.disabled, .btn-primary.disabled:hover, .btn-primary.disabled:active{
	background-color: #74BAC0;
	border-color: transparent;
	}

.btn-primary:hover {
  color: #ffffff;
  background-color: #3ae0ec;
  border-color: transparent;
}

.btn-primary#warn.disabled, .btn-primary#warn.disabled:hover, .btn-primary#warn.disabled:active{
	background-color: #798481;
	border-color: transparent;
	}

.btn-primary#warn, .btn-primary#warn:active{
	background-color: #ff0000;
	border-color: transparent;
}

.btn-primary#warn:hover {
  color: #ffffff;
  background-color: #ff6666;
  border-color: transparent;
}

h1{
	color: #5c6952;
	font-size: 65px;
	font-weight: normal;
	margin-bottom: 0px;
}

h2{
	color: #979e91;
	font-size: 32px;
	font-weight: normal;
	margin-top: 0px;
	margin-bottom: 25px;
}

h3{
	color: #000000;
	font-size: 20px;
	font-weight: normal;
	margin-top: 0px;
	margin-bottom: 25px;
}

p, div {
    font-family: 'Berlin Sans FB', "Ropa Sans";
}

label{
	color: #000000;
	font-size: 20px;
	font-weight: normal;
}


text:
.class public Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;
.super Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;
.source "SprAttributeShadow.java"

# instance fields
.field public dx:F

.field public dy:F

.field public radius:F

.field public shadowColor:I

# direct methods
.method public constructor <init>()V
    .locals 3

    const/4 v2, 0x0

    const/4 v1, 0x0

    const/16 v0, 0x70

    invoke-direct {p0, v0}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;-><init>(B)V

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    iput v2, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iput v2, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    return-void
.end method

.method public constructor <init>(FFFI)V
    .locals 2

    const/4 v1, 0x0

    const/16 v0, 0x70

    invoke-direct {p0, v0}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;-><init>(B)V

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    const/4 v0, 0x0

    iput v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    iput p1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iput p2, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iput p3, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    iput p4, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    return-void
.end method

.method public constructor <init>(Lcom/samsung/android/graphics/spr/document/SprInputStream;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v1, 0x0

    const/16 v0, 0x70

    invoke-direct {p0, v0}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;-><init>(B)V

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iput v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    const/4 v0, 0x0

    iput v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    invoke-virtual {p0, p1}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->fromSPR(Lcom/samsung/android/graphics/spr/document/SprInputStream;)V

    return-void
.end method

# virtual methods
.method public bridge synthetic clone()Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/CloneNotSupportedException;
        }
    .end annotation

    invoke-virtual {p0}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->clone()Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;

    move-result-object v0

    return-object v0
.end method

.method public clone()Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/CloneNotSupportedException;
        }
    .end annotation

    invoke-super {p0}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;->clone()Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeBase;

    move-result-object v0

    check-cast v0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;

    iget v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iput v1, v0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    iget v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iput v1, v0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    iget v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    iput v1, v0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    iget v1, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    iput v1, v0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    return-object v0
.end method

.method public bridge synthetic clone()Ljava/lang/Object;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/CloneNotSupportedException;
        }
    .end annotation

    invoke-virtual {p0}, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->clone()Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;

    move-result-object v0

    return-object v0
.end method

.method public fromSPR(Lcom/samsung/android/graphics/spr/document/SprInputStream;)V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-virtual {p1}, Lcom/samsung/android/graphics/spr/document/SprInputStream;->readFloat()F

    move-result v0

    iput v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    invoke-virtual {p1}, Lcom/samsung/android/graphics/spr/document/SprInputStream;->readFloat()F

    move-result v0

    iput v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    invoke-virtual {p1}, Lcom/samsung/android/graphics/spr/document/SprInputStream;->readFloat()F

    move-result v0

    iput v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    invoke-virtual {p1}, Lcom/samsung/android/graphics/spr/document/SprInputStream;->readInt()I

    move-result v0

    iput v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    return-void
.end method

.method public getSPRSize()I
    .locals 1

    const/16 v0, 0x10

    return v0
.end method

.method public toSPR(Ljava/io/DataOutputStream;)V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    iget v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->radius:F

    invoke-virtual {p1, v0}, Ljava/io/DataOutputStream;->writeFloat(F)V

    iget v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dx:F

    invoke-virtual {p1, v0}, Ljava/io/DataOutputStream;->writeFloat(F)V

    iget v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->dy:F

    invoke-virtual {p1, v0}, Ljava/io/DataOutputStream;->writeFloat(F)V

    iget v0, p0, Lcom/samsung/android/graphics/spr/document/attribute/SprAttributeShadow;->shadowColor:I

    invoke-virtual {p1, v0}, Ljava/io/DataOutputStream;->writeInt(I)V

    return-void
.end method


text:
package com.markeloff.practise.ipc;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.markeloff.practise.R;
import com.markeloff.practise.ipc.data.Person;

public class SerializableDemoActivity extends AppCompatActivity {
    private static final String TAG = SerializableDemoActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_serializable_demo);
        setTitle("Serializable Demo");

        initComponents();
    }

    void initComponents(){
        TextView mTextView = (TextView) this.findViewById(R.id.tv_serializable);
        Person mPerson = (Person)getIntent().getSerializableExtra("Person");
        mTextView.setText("name is: " + mPerson.getName() + "\n" +
                "age is: " + mPerson.getAge());
    }

}


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Taut.Messages;

namespace Taut.IMs
{
    public class DirectMessageChannel
    {
        public string Id { get; set; }

        [JsonProperty("is_im")]
        public bool IsDirectMessageChannel { get; set; }

        [JsonProperty("user")]
        public string UserId { get; set; }

        public double Created { get; set; }

        [JsonProperty("is_user_deleted")]
        public bool IsUserDeleted { get; set; }

        [JsonProperty("is_open")]
        public bool IsOpen { get; set; }

        [JsonProperty("last_read")]
        public double LastRead { get; set; }

        [JsonProperty("unread_count")]
        public int UnreadCount { get; set; }

        public Message Latest { get; set; }
    }
}


text:
package org.apache.hadoop.io;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.UTFDataFormatException;
import java.nio.ByteBuffer;
import java.util.Random;

import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.StringUtils;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

/** Unit tests for UTF8. */
@SuppressWarnings("deprecation")
public class TestUTF8 {

  private static final Random RANDOM = new Random();

  public static String getTestString() throws Exception {
    StringBuilder buffer = new StringBuilder();
    int length = RANDOM.nextInt(100);
    for (int i = 0; i < length; i++) {
      buffer.append((char)(RANDOM.nextInt(Character.MAX_VALUE)));
    }
    return buffer.toString();
  }

  @Test
  public void testWritable() throws Exception {
    for (int i = 0; i < 10000; i++) {
      TestWritable.testWritable(new UTF8(getTestString()));
    }
  }

  @Test
  public void testGetBytes() throws Exception {
    for (int i = 0; i < 10000; i++) {

      // generate a random string
      String before = getTestString();

      // Check that the bytes are stored correctly in Modified-UTF8 format.
      // Note that the DataInput and DataOutput interfaces convert between
      // bytes and Strings using the Modified-UTF8 format.
      assertEquals(before, readModifiedUTF(UTF8.getBytes(before)));
    }
  }

  private String readModifiedUTF(byte[] bytes) throws IOException {
    final short lengthBytes = (short)2;
    ByteBuffer bb = ByteBuffer.allocate(bytes.length + lengthBytes);
    bb.putShort((short)bytes.length).put(bytes);
    ByteArrayInputStream bis = new ByteArrayInputStream(bb.array());
    DataInputStream dis = new DataInputStream(bis);
    return dis.readUTF();
  }

  @Test
  public void testIO() throws Exception {
    DataOutputBuffer out = new DataOutputBuffer();
    DataInputBuffer in = new DataInputBuffer();

    for (int i = 0; i < 10000; i++) {
      // generate a random string
      String before = getTestString();

      // write it
      out.reset();
      UTF8.writeString(out, before);

      // test that it reads correctly
      in.reset(out.getData(), out.getLength());
      String after = UTF8.readString(in);
      assertEquals(before, after);

      // test that it reads correctly with DataInput
      in.reset(out.getData(), out.getLength());
      String after2 = in.readUTF();
      assertEquals(before, after2);
    }

  }

  @Test
  public void testNullEncoding() throws Exception {
    String s = new String(new char[] { 0 });

    DataOutputBuffer dob = new DataOutputBuffer();
    new UTF8(s).write(dob);

    assertEquals(s, new String(dob.getData(), 2, dob.getLength()-2, "UTF-8"));
  }

  /**
   * Test encoding and decoding of UTF8 outside the basic multilingual plane.
   *
   * This is a regression test for HADOOP-9103.
   */
  @Test
  public void testNonBasicMultilingualPlane() throws Exception {
    // Test using the "CAT FACE" character (U+1F431)
    // See http://www.fileformat.info/info/unicode/char/1f431/index.htm
    String catFace = "\uD83D\uDC31";

    // This encodes to 4 bytes in UTF-8:
    byte[] encoded = catFace.getBytes("UTF-8");
    assertEquals(4, encoded.length);
    assertEquals("f09f90b1", StringUtils.byteToHexString(encoded));

    // Decode back to String using our own decoder
    String roundTrip = UTF8.fromBytes(encoded);
    assertEquals(catFace, roundTrip);
  }

  /**
   * Test that decoding invalid UTF8 throws an appropriate error message.
   */
  @Test
  public void testInvalidUTF8() throws Exception {
    byte[] invalid = new byte[] {
        0x01, 0x02, (byte)0xff, (byte)0xff, 0x01, 0x02, 0x03, 0x04, 0x05 };
    try {
      UTF8.fromBytes(invalid);
      fail("did not throw an exception");
    } catch (UTFDataFormatException utfde) {
      GenericTestUtils.assertExceptionContains(
          "Invalid UTF8 at ffff01020304", utfde);
    }
  }

  /**
   * Test for a 5-byte UTF8 sequence, which is now considered illegal.
   */
  @Test
  public void test5ByteUtf8Sequence() throws Exception {
    byte[] invalid = new byte[] {
        0x01, 0x02, (byte)0xf8, (byte)0x88, (byte)0x80,
        (byte)0x80, (byte)0x80, 0x04, 0x05 };
    try {
      UTF8.fromBytes(invalid);
      fail("did not throw an exception");
    } catch (UTFDataFormatException utfde) {
      GenericTestUtils.assertExceptionContains(
          "Invalid UTF8 at f88880808004", utfde);
    }
  }

  /**
   * Test that decoding invalid UTF8 due to truncation yields the correct
   * exception type.
   */
  @Test
  public void testInvalidUTF8Truncated() throws Exception {
    // Truncated CAT FACE character -- this is a 4-byte sequence, but we
    // only have the first three bytes.
    byte[] truncated = new byte[] {
        (byte)0xF0, (byte)0x9F, (byte)0x90 };
    try {
      UTF8.fromBytes(truncated);
      fail("did not throw an exception");
    } catch (UTFDataFormatException utfde) {
      GenericTestUtils.assertExceptionContains(
          "Truncated UTF8 at f09f90", utfde);
    }
  }
}


text:
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// 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.

/**
 * @fileoverview Unit tests for goog.labs.userAgent.browser.
 */

goog.provide('goog.labs.userAgent.browserTest');

goog.require('goog.labs.userAgent.browser');
goog.require('goog.labs.userAgent.testAgents');
goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.jsunit');

goog.setTestOnly('goog.labs.userAgent.browserTest');

var propertyReplacer = new goog.testing.PropertyReplacer();

function setUp() {
  // disable memoization
  propertyReplacer.set(goog.memoize, 'ENABLE_MEMOIZE', false);
}

function tearDown() {
  propertyReplacer.reset();
}

function testOpera() {
  setGlobalUAString(goog.labs.userAgent.testAgents.OPERA_10);
  assertTrue(goog.labs.userAgent.browser.isOpera());
  assertVersion('10.00');
  assertVersionBetween('10.00', '10.10');

  setGlobalUAString(goog.labs.userAgent.testAgents.OPERA_MAC);
  assertTrue(goog.labs.userAgent.browser.isOpera());
  assertVersion('11.52');
  assertVersionBetween('11.50', '12.00');

  setGlobalUAString(goog.labs.userAgent.testAgents.OPERA_LINUX);
  assertTrue(goog.labs.userAgent.browser.isOpera());
  assertVersion('11.50');
  assertVersionBetween('11.00', '12.00');
}

function testIE() {
  setGlobalUAString(goog.labs.userAgent.testAgents.IE_6);
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('6.0');
  assertVersionBetween('5.0', '7.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_10);
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('10.6');
  assertVersionBetween('10.0', '11.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_9);
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('9.0');
  assertVersionBetween('8.0', '10.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_8);
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('8.0');
  assertVersionBetween('7.0', '9.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_8_COMPATIBILITY);
  // Test Document mode override
  setDocumentMode('9');
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('9');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_9_COMPATIBILITY);
  setDocumentMode('9');
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('9');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_9_COMPATIBILITY);
  setDocumentMode('8');
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('8');

  setGlobalUAString(goog.labs.userAgent.testAgents.IE_11);
  assertTrue(goog.labs.userAgent.browser.isIE());
  assertVersion('11.0');
  assertVersionBetween('10.0', '12.0');
}

function testFirefox() {
  setGlobalUAString(goog.labs.userAgent.testAgents.FIREFOX_19);
  assertTrue(goog.labs.userAgent.browser.isFirefox());
  assertVersion('19.0');
  assertVersionBetween('18.0', '20.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.FIREFOX_WINDOWS);
  assertTrue(goog.labs.userAgent.browser.isFirefox());
  assertVersion('14.0.1');
  assertVersionBetween('14.0', '15.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.FIREFOX_LINUX);
  assertTrue(goog.labs.userAgent.browser.isFirefox());
  assertVersion('15.0.1');
}

function testChrome() {
  setGlobalUAString(goog.labs.userAgent.testAgents.CHROME_ANDROID);
  assertTrue(goog.labs.userAgent.browser.isChrome());
  assertVersion('18.0.1025.133');
  assertVersionBetween('18.0', '19.0');
  assertVersionBetween('17.0', '18.1');

  setGlobalUAString(goog.labs.userAgent.testAgents.CHROME_IPHONE);
  assertTrue(goog.labs.userAgent.browser.isChrome());
  assertVersion('22.0.1194.0');
  assertVersionBetween('22.0', '23.0');
  assertVersionBetween('22.0', '22.10');

  setGlobalUAString(goog.labs.userAgent.testAgents.CHROME_MAC);
  assertTrue(goog.labs.userAgent.browser.isChrome());
  assertVersion('24.0.1309.0');
  assertVersionBetween('24.0', '25.0');
  assertVersionBetween('24.0', '24.10');
}

function testSafari() {
  setGlobalUAString(goog.labs.userAgent.testAgents.IPAD_6);
  assertTrue(goog.labs.userAgent.browser.isSafari());
  assertVersion('6.0');
  assertVersionBetween('5.1', '7.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.SAFARI_6);
  assertTrue(goog.labs.userAgent.browser.isSafari());
  assertVersion('6.0');
  assertVersionBetween('6.0', '7.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.SAFARI_IPHONE);
  assertTrue(goog.labs.userAgent.browser.isSafari());
  assertVersion('5.0.2');
  assertVersionBetween('5.0', '6.0');
}

function testAndroidBrowser() {
  setGlobalUAString(goog.labs.userAgent.testAgents.ANDROID_BROWSER_235);
  assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());
  assertVersion('4.0');
  assertVersionBetween('3.0', '5.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.ANDROID_BROWSER_403);
  assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());
  assertVersion('4.0');
  assertVersionBetween('3.0', '5.0');

  setGlobalUAString(goog.labs.userAgent.testAgents.ANDROID_BROWSER_233);
  assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());
  assertVersion('4.0');
  assertVersionBetween('3.0', '5.0');
}

function setGlobalUAString(uaString) {
  var mockGlobal = {
    'navigator': {
      'userAgent': uaString
    }
  };
  propertyReplacer.set(goog, 'global', mockGlobal);
}

function setDocumentMode(docMode) {
  var mockDocument = {
    'documentMode': docMode
  };
  propertyReplacer.set(goog.global, 'document', mockDocument);
}

function assertVersion(version) {
  assertEquals(version, goog.labs.userAgent.browser.getVersion());
}

function assertVersionBetween(lowVersion, highVersion) {
  assertTrue(goog.labs.userAgent.browser.isVersionOrHigher(lowVersion));
  assertFalse(goog.labs.userAgent.browser.isVersionOrHigher(highVersion));
}


text:
import scuff.FakeType

package object delta {

  type Revision = Int // >= 0
  type Tick = Long

  type Channel = Channel.Type
  val Channel: FakeType[String] { type Type <: AnyRef } = new FakeType[String] {
    type Type = String
    def apply(str: String) = str
  }

}


text:
Mimiker is an experimental implementation of a simple UNIX-like operating
system for the Malta board and Raspberry Pi 3.

### Main project goals

* to be a research system helping us to understand structure of UNIX kernels
* implement only Kernel of the system on our own.
* keep User Space interface as compatible as possible with
  NetBSD. That way we'll be capable to run all programs designed for that
  system, we already are able to run a few of those. Consequence of that
  is all user header files are the same as NetBSD's.
* we want kernel to be run on a modern architecture, we started with MIPS32,
  but currently we are switching to AArch64 (Raspberry Pi 3)
* we love to KISS

### More significant tools we use to run system

* QEMU - system emulator allowing us to run MIPS and AArch64 guest code
  on x86-64 hosts.
* Tmux - terminal multiplexer, that allows us to access multiple terminals in
  one window
* Korn Shell (`ksh`) - simple and only one shell that we already ported

#### How system is run?

When you turn on the system with `./launch` [script][1] system is being run in QEMU.
Multiple terminals are connected to VM. Between these you can switch with Tmux.
One of them is klog (log with kernel messages), the second one is GDB.
The other one there can be Korn Shell working in the system.

### Project file hierarchy

Most of the incoherence in file hierarchy come from expectations of C
programs to find header files in specific locations.
More information can be found in [`hier(7)`][2].

* `bin/` and `usr.bin/` programs from NetBSD that are
  considered to be ready to run, because are build during compilation
  * `bin/utest/` tests, that are supposed to be run in User Space,
    testing mostly syscalls
* `contrib/` programs we are capable to build without significant modifications.
  Modifications, if any, are applied as patches
* `build/` build scripts, shared by all Makefiles
* `etc/` system configuration files and scripts
* `include/` folder with all the header files for code ran in User and Kernel
  Space. That one has most of the incoherences, because
  everything here is compatible with NetBSD and the standard C library.
  * `include/dev/` description of hardware registers and struct definitions.
  Vast majority of contained files has been acquired from existing systems.
  Everything that concerns drivers are located here.
  * `include/mips/` and `/include/aarch64` parts depending on architecture,
    partly acquired, available for Kernel
  * `include/sys/` headers mostly for Kernel, but with parts dedicated for
    User Space
* `lib/` User Space libraries ported from NetBSD, but only these we actually need
  * `lib/csu/` files `crt0` ("C runtime 0") describing program life before
  `main` function and after calling `return` at the end
  * `lib/libc/` C library files, parts that depend on architecture are written
    in Assembly
* `sys/` actual Kernel code
  * `sys/kern/` main part of Kernel
  * `sys/debug` Python scripts extending GDB capabilities.
  * `sys/drv` system drivers for hardware devices
  * `sys/script` scripts generating glue code, i.e. syscalls
  * `sys/tests` tests ran in Kernel Space
  * `sys/aarch64/` and `sys/mips/` hardware dependent parts
* `toolchain/` tools for development environment
  * `toolchain/gnu/` mimiker compiler toolchain containing
    cross-compiler for building mimiker on your desktop.
    It comes in two versions for both supported platforms
  * `toolchain/qemu-mimiker/` debian install scripts and patches for QEMU -
    machine emulator and simulator for running mimiker
  * `toolchain/openocd-mimiker` port of OpenOCD -
    Interface for hardware debugger. Adapter between Raspberry Pi 3 board and GDB
* `Dockerfile` description of environment for GitHub Actions build and testing
* `.github/workflows/` YAML scripts for Continuous integration
  * `.github/workflows/default.yml` CI script that builds system and
    tests it in cloud. Run every time new commit it pushed on any branch.
  * `.github/workflows/deploy_wiki.yml` GitHub Actions script that runs
    script from `wiki/` every time new wiki document file lands on Master
* `wiki/` contains documents of our wiki and script
  that publishes files from `wiki/docs` to GitHub Wiki

### Licence

This project is licensed under the BSD 3-Clause. Details of code we can
use can be found [here][3] and [that][4] is a nice cheat sheet.
The Simplest inferences include facts that we can use all the code under MIT
licence and we are not supposed to look at or be inspired by any code
under GPL.

[1]: https://github.com/cahirwpz/mimiker#readme
[2]: https://man.netbsd.org/hier.7
[3]: https://en.wikipedia.org/wiki/License_compatibility
[4]: https://en.wikipedia.org/wiki/License_compatibility#/media/File:Floss-license-slide-image.svg


text:
===================
Sphinx Morpho Theme
===================

Clean, materialized theme for Sphinx

Documentation
=============

    https://sphinx_morpho_theme.readthedocs.org/

Options
=======

:theme_user_style:
 Allows the user to set a additional CSS.

:theme_user_script:
 Allows the user to set a additional JS.

License
=======

::

   Copyright (C) 2016 Carlos Jenkins
   Copyright (C) 2016 Carolina Aguilar

   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.


text:
pymatgen.phonon package
=======================

Subpackages
-----------

.. toctree::
   :maxdepth: 7

Submodules
----------

.. toctree::
   :maxdepth: 7

   pymatgen.phonon.bandstructure
   pymatgen.phonon.dos
   pymatgen.phonon.gruneisen
   pymatgen.phonon.ir_spectra
   pymatgen.phonon.plotter

Module contents
---------------

.. automodule:: pymatgen.phonon
   :members:
   :undoc-members:
   :show-inheritance:


text:
exports.Parser = require("./lib/parser");
exports.Serialiser = require("./lib/serialiser");


text:
package org.jetbrains.idea.maven.model;

import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Objects;

public class MavenProjectProblem implements Serializable {
  //todo: this enum values are write-only now
  public enum ProblemType {
    SYNTAX, STRUCTURE, DEPENDENCY, PARENT, SETTINGS_OR_PROFILES, REPOSITORY
  }

  private final boolean myRecoverable;
  private final String myPath;
  private final String myDescription;
  private final ProblemType myType;
  @Nullable
  private final MavenArtifact myMavenArtifact;

  public static MavenProjectProblem createStructureProblem(String path, String description, boolean recoverable) {
    return createProblem(path, description, MavenProjectProblem.ProblemType.STRUCTURE, recoverable);
  }

  public static MavenProjectProblem createStructureProblem(String path, String description) {
    return createProblem(path, description, MavenProjectProblem.ProblemType.STRUCTURE, false);
  }

  public static MavenProjectProblem createSyntaxProblem(String path, MavenProjectProblem.ProblemType type) {
    return createProblem(path, MessageFormat.format("''{0}'' has syntax errors", new File(path).getName()), type, false);
  }

  public static MavenProjectProblem createProblem(String path,
                                                  String description,
                                                  MavenProjectProblem.ProblemType type,
                                                  boolean recoverable) {
    return new MavenProjectProblem(path, description, type, recoverable);
  }

  public static MavenProjectProblem createRepositoryProblem(String path,
                                                            String description,
                                                            boolean recoverable,
                                                            MavenArtifact mavenArtifact) {
    return new MavenProjectProblem(path, description, ProblemType.REPOSITORY, recoverable, mavenArtifact);
  }

  public static MavenProjectProblem createUnresolvedArtifactProblem(String path,
                                                                    String description,
                                                                    boolean recoverable,
                                                                    MavenArtifact mavenArtifact) {
    return new MavenProjectProblem(path, description, ProblemType.DEPENDENCY, recoverable, mavenArtifact);
  }

  public static Collection<MavenProjectProblem> createProblemsList() {
    return createProblemsList(Collections.emptySet());
  }

  public static Collection<MavenProjectProblem> createProblemsList(Collection<? extends MavenProjectProblem> copyThis) {
    return new LinkedHashSet<MavenProjectProblem>(copyThis);
  }

  public MavenProjectProblem(String path, String description, ProblemType type, boolean recoverable) {
    this(path, description, type, recoverable, null);
  }

  public MavenProjectProblem(String path, String description, ProblemType type, boolean recoverable, MavenArtifact mavenArtifact) {
    myPath = path;
    myDescription = description;
    myType = type;
    myRecoverable = recoverable;
    myMavenArtifact = mavenArtifact;
  }

  public String getPath() {
    return myPath;
  }

  public boolean isRecoverable() {
    return myRecoverable;
  }

  public @Nullable String getDescription() {
    return myDescription;
  }

  public ProblemType getType() {
    return myType;
  }

  @Nullable
  public MavenArtifact getMavenArtifact() {
    return myMavenArtifact;
  }

  @Override
  public String toString() {
    return myType + ":" + myDescription + ":" + myPath;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    MavenProjectProblem that = (MavenProjectProblem)o;

    if (!Objects.equals(myDescription, that.myDescription)) return false;
    if (myType != that.myType) return false;
    if (!Objects.equals(myPath, that.myPath)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = myPath != null ? myPath.hashCode() : 0;
    result = 31 * result + (myDescription != null ? myDescription.hashCode() : 0);
    result = 31 * result + (myType != null ? myType.hashCode() : 0);
    return result;
  }
}


text:
package org.sireum.intellij

import java.io._
import java.util.concurrent.BlockingQueue

import com.intellij.ide.plugins.PluginManager
import com.intellij.ide.util.PropertiesComponent
import com.intellij.notification.{Notification, NotificationType}
import com.intellij.openapi.components._
import com.intellij.openapi.extensions.PluginId
import com.intellij.openapi.fileChooser._
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.util.SystemInfo
import org.sireum.intellij.logika.LogikaConfigurable
import org.sireum.util._
import org.sireum.util.jvm.Exec

object SireumApplicationComponent {
  private val sireumKey = "org.sireum."
  private val sireumHomeKey = sireumKey.dropRight(1)
  private val sireumVarArgsKey = sireumKey + "vmargs"
  private val sireumEnvVarsKey = sireumKey + "envvars"
  private val sireumPluginVersionKey = sireumKey + "plugin.version"
  private val isDev: Boolean = "true" == System.getProperty("org.sireum.ive.dev")
  private val dev: String = if (isDev) "-dev" else ""

  private lazy val currentPluginVersion =
    PluginManager.getPlugin(
      PluginId.getId("org.sireum.intellij")).getVersion
  private[intellij] var sireumHomeOpt: Option[File] = None
  private[intellij] var vmArgs: ISeq[String] = ivector("-Xss2m")
  private[intellij] var envVars = ilinkedMapEmpty[String, String]
  private[intellij] var pluginVersion: String = ""

  private var terminated: Boolean = false

  final def getSireumHome(project: Project = null): Option[File] = {
    if (sireumHomeOpt.isEmpty) {
      val env = System.getenv("SIREUM_HOME")
      sireumHomeOpt = checkSireumDir(env)
      if (sireumHomeOpt.isEmpty && SystemInfo.isWindows)
        sireumHomeOpt = checkSireumDir("C:\\Sireum" + dev)
      if (sireumHomeOpt.isEmpty && SystemInfo.isMac) {
        val appResources = s"/Applications/Sireum$dev.app/Contents/Resources/sireum-v3"
        sireumHomeOpt = checkSireumDir(appResources)
        if (sireumHomeOpt.isEmpty)
          sireumHomeOpt = checkSireumDir(System.getProperty("user.home") + appResources)
      }
      if (sireumHomeOpt.isEmpty && SystemInfo.isLinux)
        sireumHomeOpt = checkSireumDir(System.getProperty("user.home") + "/Applications/Sireum" + dev)
      if (sireumHomeOpt.isEmpty) {
        browseSireumHome(project).foreach(p =>
          sireumHomeOpt = checkSireumDir(p))
      }
    }
    sireumHomeOpt match {
      case Some(homeDir) =>
        checkSireumInSync(homeDir)
        saveConfiguration()
      case _ =>
    }
    sireumHomeOpt
  }

  private def isSource(homeDir: File): Boolean =
    currentPluginVersion.contains("-SNAPSHOT") ||
      new File(homeDir, "bin/detect-build.sh").exists

  private def checkSireumInSync(homeDir: File): Unit = {
    if (currentPluginVersion.contains("-SNAPSHOT")) {
      pluginVersion = ""
      return
    }
    if ("" == pluginVersion) pluginVersion = currentPluginVersion
    if (currentPluginVersion != pluginVersion && isSource(homeDir)) {
      Messages.showInfoMessage(
        s"""The Sireum IntelliJ plugin has been updated.
           |Please update Sireum through the command-line:
           |(1) do a git pull, and
           |(2) run Sireum again.""".stripMargin,
        "Sireum May Need Updating")
    }
    pluginVersion = currentPluginVersion
  }

  def sireumHomeString: String = sireumHomeOpt.map(_.getAbsolutePath).getOrElse("")

  def envVarsString: String = envVars.map(p => s"${p._1}=${p._2}").
    mkString(scala.util.Properties.lineSeparator)

  def vmArgsString: String = vmArgs.mkString(" ")

  def browseSireumHome(project: Project = null): Option[String] = {
    var pathOpt: Option[String] = None
    val desc = FileChooserDescriptorFactory.createSingleFolderDescriptor()
    desc.setTitle("Select Sireum v3 directory")
    FileChooser.chooseFile(
      desc,
      project, null, t => pathOpt = Some(t.getCanonicalPath))
    pathOpt.foreach(path =>
      if (checkSireumDir(path).isEmpty)
        Messages.showMessageDialog(project, sireumInvalid(path),
          "Invalid Sireum Configuration", null)
    )
    pathOpt
  }

  def sireumInvalid(path: String): String =
    s"""Could not confirm a working Sireum installation in $path (with the specified VM arguments and environment variables in the settings).
       |Make sure to run Sireum at least once from the command-line.""".stripMargin

  def runSireum(project: Project, input: Option[String], args: String*): Option[String] =
    getSireumHome(project) match {
      case Some(d) => runSireum(d.getAbsolutePath, vmArgs, envVars, input, args)
      case _ => None
    }

  def getSireumProcess(project: Project,
                       queue: BlockingQueue[String],
                       processOutput: String => Unit,
                       args: String*): Option[scala.sys.process.Process] =
    getSireumHome(project) match {
      case Some(d) =>
        val javaPath = new File(d, "platform/java/bin/java").getAbsolutePath
        val sireumJarPath = new File(d, "bin/sireum.jar").getAbsolutePath
        Some(new Exec().process((javaPath +: vmArgs) ++
          Seq("-Dfile.encoding=UTF-8", "-jar", sireumJarPath) ++
          args, { os =>
          try {
            val w = new OutputStreamWriter(os)
            val lineSep = scala.util.Properties.lineSeparator
            while (!terminated) {
              val m = queue.take()
              w.write(m)
              w.write(lineSep)
              w.flush()
            }
          } catch {
            case _: InterruptedException =>
          } finally os.close()
        }, { is =>
          try {
            val r = new BufferedReader(new InputStreamReader(is))
            while (!terminated) {
              val line = r.readLine()
              if (line != null) {
                processOutput(line)
              }
            }
          } catch {
            case _: IOException =>
          } finally is.close()
        }, ("SIREUM_HOME", d.getAbsolutePath)))
      case _ => None
    }

  private def runSireum(path: String,
                        vmArgs: ISeq[String],
                        envVars: ILinkedMap[String, String],
                        input: Option[String],
                        args: Seq[String]): Option[String] = {
    val d = new File(path)
    val javaPath = new File(d, "platform/java/bin/java").getAbsolutePath
    val sireumJarPath = new File(d, "bin/sireum.jar").getAbsolutePath
    if (path.trim == "") None
    else new Exec().run(0,
      (javaPath +: vmArgs) ++ Seq("-Dfile.encoding=UTF-8", "-jar",
        sireumJarPath) ++ args,
      input, envVars.toSeq :+ ("SIREUM_HOME", path): _*) match {
      case Exec.StringResult(s, _) => Some(s)
      case _ => None
    }
  }

  private[intellij] final def
  checkSireumDir(path: String,
                 vmArgs: ISeq[String] = this.vmArgs,
                 envVars: ILinkedMap[String, String] = this.envVars): Option[File] = {
    if (path == null) return None
    runSireum(path, vmArgs, envVars, None, Seq()) match {
      case Some(s) =>
        if (s.lines.exists(
          _.trim == "Sireum: A Software Analysis Platform (v3)")) {
          Some(new File(path))
        } else None
      case _ => None
    }
  }

  def parseEnvVars(text: String): Option[ILinkedMap[String, String]] = {
    var r = ilinkedMapEmpty[String, String]
    for (l <- text.split('\n')) {
      val kv = l.split('=')
      if (kv.length != 2) return None
      val Array(k, v) = kv
      if (k.charAt(0).isDigit) return None
      if (!k.forall(c => c == '_' || c.isLetterOrDigit)) return None
      r += k -> v
    }
    Some(r)
  }

  def parseVmArgs(text: String): Option[ISeq[String]] =
    if (text.trim == "") Some(ivectorEmpty)
    else {
      val r = text.split(' ').toVector
      if (r.forall(_.head == '-')) Some(r)
      else None
    }

  def loadConfiguration(): Unit = {
    val pc = PropertiesComponent.getInstance
    envVars = Option(pc.getValue(sireumEnvVarsKey)).flatMap(parseEnvVars).getOrElse(ilinkedMapEmpty)
    vmArgs = Option(pc.getValue(sireumVarArgsKey)).flatMap(parseVmArgs).getOrElse(ivectorEmpty)
    sireumHomeOpt = Option(pc.getValue(sireumHomeKey)).flatMap(p => checkSireumDir(p, vmArgs, envVars))
    pluginVersion = Option(pc.getValue(sireumPluginVersionKey)).getOrElse("")
  }

  def saveConfiguration(): Unit = {
    val pc = PropertiesComponent.getInstance
    pc.setValue(sireumHomeKey, sireumHomeOpt.map(_.getAbsolutePath).orNull)
    pc.setValue(sireumEnvVarsKey, envVarsString)
    pc.setValue(sireumVarArgsKey, vmArgs.mkString(" "))
    pc.setValue(sireumPluginVersionKey, pluginVersion)
  }
}

import SireumApplicationComponent._

class SireumApplicationComponent extends ApplicationComponent {
  override val getComponentName: String = "Sireum Application"

  override def initComponent(): Unit = {
    SireumApplicationComponent.loadConfiguration()
    LogikaConfigurable.loadConfiguration()

    val suffix = "options/notifications.xml"
    Option(System.getProperty("org.sireum.ive")) match {
      case Some(name) =>
        val homeDir = new File(System.getProperty("user.home"))
        val notificationFileOpt =
          if (SystemInfo.isMac) {
            val f = new File(homeDir, s"Library/Preferences/$name/$suffix")
            if (f.exists) None else Some(f)
          } else if (SystemInfo.isLinux || SystemInfo.isWindows) {
            val f = new File(homeDir, s".$name/config/$suffix")
            if (f.exists) None else Some(f)
          } else None
        for (f <- notificationFileOpt) try {
          val fw = new java.io.FileWriter(f)
          fw.write(
            """<application>
              |  <component name="NotificationConfiguration">
              |    <notification groupId="Platform and Plugin Updates" displayType="STICKY_BALLOON" shouldLog="false" />
              |  </component>
              |</application>
              |""".stripMargin)
          fw.close()
        } catch {
          case _: Throwable =>
        }
      case _ =>
    }

    SireumApplicationComponent.sireumHomeOpt match {
      case Some(homeDir) =>
        if (!isSource(homeDir)) {
          val reinstall = try {
            import org.sireum.util.jvm._
            val localVer = FileUtil.readFile(FileUtil.toUri(new File(homeDir, "bin/VER")))._1.trim
            val onlineVer = scala.io.Source.fromURL(s"http://files.sireum.org/sireum-v3$dev-VER").mkString.trim
            localVer != onlineVer
          } catch {
            case _: Throwable => false
          }
          if (reinstall)
            new Thread() {
              override def run(): Unit = {
                Thread.sleep(5000)
                Util.notify(new Notification("Sireum Logika", "Sireum Update",
                  s"A newer Sireum$dev version is available; please re-download/install.",
                  NotificationType.INFORMATION),
                  null, shouldExpire = false)
              }
            }.start()
        }
      case _ =>
    }
  }

  override def disposeComponent(): Unit = {
    SireumApplicationComponent.terminated = true
  }
}


text:
using System;

namespace TagLib.IIM
{
	/// <summary>
	/// Processes all IPTC-IIM segments
	/// </summary>
	public class IIMReader
	{
		/// <summary>
		/// The magic bytes that start a new IPTC-IIM segment
		/// </summary>
		private static readonly byte[] IPTC_IIM_SEGMENT = new byte[] { 0x1C, 0x02};

		private IIMTag Tag { get; set; }
		private ByteVector Data { get; set; }

		public IIMReader (ByteVector data)
		{
			Data = data;
			Tag = new IIMTag ();
		}

		public IIMTag Process ()
		{
			// now process the IIM segments which all start with 0x1C 0x02 followed by the type
			// of the IIM segment
			int findOffset = 0;
			int count = 0;
			for (int i = Data.Find (IPTC_IIM_SEGMENT, findOffset); i >= findOffset; i = Data.Find (IPTC_IIM_SEGMENT, findOffset)) {
				count++;
				// skip over segment marker
				i += IPTC_IIM_SEGMENT.Length;

				int len = Data.Mid (i + 1).ToUShort ();

				// ENHANCE: enhance encoding used for string conversion. Unfortunately this is
				// not detectable from IIM data.
				switch (Data [i]) {
					case 5: // Object Name
						Tag.Title = Data.ToString (StringType.Latin1, i + 3, len);
						break;
					case 25: // Keywords
						Tag.AddKeyword (Data.ToString (StringType.Latin1, i + 3, len));
						break;
					case 80: // By-line
						Tag.Creator = Data.ToString (StringType.Latin1, i + 3, len);
						break;
					case 116: // Copyright notice
						Tag.Copyright = Data.ToString (StringType.Latin1, i + 3, len);
						break;
					case 120: // Caption/Abstract
						Tag.Comment = Data.ToString (StringType.Latin1, i + 3, len);
						break;
				}
				findOffset = i + 3 + len;
			}
			if (count == 0)
				return null;
			return Tag;
		}
	}
}


text:
import pandas
import pandasql

def aggregate_query(filename):
    # Read in our aadhaar_data csv to a pandas dataframe.  Afterwards, we rename the columns
    # by replacing spaces with underscores and setting all characters to lowercase, so the
    # column names more closely resemble columns names one might find in a table.

    aadhaar_data = pandas.read_csv(filename)
    aadhaar_data.rename(columns=lambda x: x.replace(' ', '_').lower(), inplace=True)

    # Write a query that will select from the aadhaar_data table how many men and how
    # many women over the age of 50 have had aadhaar generated for them in each district.
    # aadhaar_generated is a column in the Aadhaar Data that denotes the number who have had
    # aadhaar generated in each row of the table.
    #
    # Note that in this quiz, the SQL query keywords are case sensitive.
    # For example, if you want to do a sum make sure you type 'sum' rather than 'SUM'.
    #

    # The possible columns to select from aadhaar data are:
    #     1) registrar
    #     2) enrolment_agency
    #     3) state
    #     4) district
    #     5) sub_district
    #     6) pin_code
    #     7) gender
    #     8) age
    #     9) aadhaar_generated
    #     10) enrolment_rejected
    #     11) residents_providing_email,
    #     12) residents_providing_mobile_number
    #
    # You can download a copy of the aadhaar data that we are passing
    # into this exercise below:
    # https://s3.amazonaws.com/content.udacity-data.com/courses/ud359/aadhaar_data.csv

    q =  """
    SELECT gender, district, sum(aadhaar_generated) from aadhaar_data WHERE age>50 GROUP BY gender, district;
    """

    # Execute your SQL command against the pandas frame
    aadhaar_solution = pandasql.sqldf(q.lower(), locals())
    return aadhaar_solution

aadhaar_filename = 'aadhaar_data/aadhaar_data.csv'
print(aggregate_query(aadhaar_filename))