- Imported from https://github.com/supermegamestre/Project-Real-Resurrection-3 - APKTool decompilation (Smali bytecode) for modding and rebuilding APK - Supports both 32-bit (armeabi-v7a) and 64-bit (arm64-v8a) architectures - Includes full Smali source, resources, and native libraries - Ready to rebuild APK after modifications with apktool b command - Added comprehensive README-apktool.md with modding guide This branch complements the JADX branches: - Use JADX (main/discord-community) to UNDERSTAND code (readable Java) - Use APKTool (this branch) to MODIFY and REBUILD APK (editable Smali) Total: 44,417 files, 538.51 MB Smali source code
486 lines
12 KiB
Smali
486 lines
12 KiB
Smali
.class Landroidx/appcompat/app/TwilightManager;
|
|
.super Ljava/lang/Object;
|
|
.source "SourceFile"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final SUNRISE:I = 0x6
|
|
|
|
.field private static final SUNSET:I = 0x16
|
|
|
|
.field private static final TAG:Ljava/lang/String; = "TwilightManager"
|
|
|
|
.field private static sInstance:Landroidx/appcompat/app/TwilightManager;
|
|
|
|
|
|
# instance fields
|
|
.field private final mContext:Landroid/content/Context;
|
|
|
|
.field private final mLocationManager:Landroid/location/LocationManager;
|
|
|
|
.field private final mTwilightState:Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/location/LocationManager;)V
|
|
.locals 1
|
|
.param p1 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Landroid/location/LocationManager;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
|
.end annotation
|
|
|
|
.line 69
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 66
|
|
new-instance v0, Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
|
|
invoke-direct {v0}, Landroidx/appcompat/app/TwilightManager$TwilightState;-><init>()V
|
|
|
|
iput-object v0, p0, Landroidx/appcompat/app/TwilightManager;->mTwilightState:Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
|
|
iput-object p1, p0, Landroidx/appcompat/app/TwilightManager;->mContext:Landroid/content/Context;
|
|
|
|
iput-object p2, p0, Landroidx/appcompat/app/TwilightManager;->mLocationManager:Landroid/location/LocationManager;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static getInstance(Landroid/content/Context;)Landroidx/appcompat/app/TwilightManager;
|
|
.locals 2
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
sget-object v0, Landroidx/appcompat/app/TwilightManager;->sInstance:Landroidx/appcompat/app/TwilightManager;
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 51
|
|
invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object p0
|
|
|
|
.line 52
|
|
new-instance v0, Landroidx/appcompat/app/TwilightManager;
|
|
|
|
const-string v1, "location"
|
|
|
|
.line 53
|
|
invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Landroid/location/LocationManager;
|
|
|
|
invoke-direct {v0, p0, v1}, Landroidx/appcompat/app/TwilightManager;-><init>(Landroid/content/Context;Landroid/location/LocationManager;)V
|
|
|
|
sput-object v0, Landroidx/appcompat/app/TwilightManager;->sInstance:Landroidx/appcompat/app/TwilightManager;
|
|
|
|
:cond_0
|
|
sget-object p0, Landroidx/appcompat/app/TwilightManager;->sInstance:Landroidx/appcompat/app/TwilightManager;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method private getLastKnownLocation()Landroid/location/Location;
|
|
.locals 6
|
|
.annotation build Landroid/annotation/SuppressLint;
|
|
value = {
|
|
"MissingPermission"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Landroidx/appcompat/app/TwilightManager;->mContext:Landroid/content/Context;
|
|
|
|
const-string v1, "android.permission.ACCESS_COARSE_LOCATION"
|
|
|
|
.line 110
|
|
invoke-static {v0, v1}, Landroidx/core/content/PermissionChecker;->checkSelfPermission(Landroid/content/Context;Ljava/lang/String;)I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const-string v0, "network"
|
|
|
|
.line 113
|
|
invoke-direct {p0, v0}, Landroidx/appcompat/app/TwilightManager;->getLastKnownLocationForProvider(Ljava/lang/String;)Landroid/location/Location;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v0, v1
|
|
|
|
:goto_0
|
|
iget-object v2, p0, Landroidx/appcompat/app/TwilightManager;->mContext:Landroid/content/Context;
|
|
|
|
const-string v3, "android.permission.ACCESS_FINE_LOCATION"
|
|
|
|
.line 116
|
|
invoke-static {v2, v3}, Landroidx/core/content/PermissionChecker;->checkSelfPermission(Landroid/content/Context;Ljava/lang/String;)I
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
const-string v1, "gps"
|
|
|
|
.line 119
|
|
invoke-direct {p0, v1}, Landroidx/appcompat/app/TwilightManager;->getLastKnownLocationForProvider(Ljava/lang/String;)Landroid/location/Location;
|
|
|
|
move-result-object v1
|
|
|
|
:cond_1
|
|
if-eqz v1, :cond_3
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
.line 124
|
|
invoke-virtual {v1}, Landroid/location/Location;->getTime()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-virtual {v0}, Landroid/location/Location;->getTime()J
|
|
|
|
move-result-wide v4
|
|
|
|
cmp-long v2, v2, v4
|
|
|
|
if-lez v2, :cond_2
|
|
|
|
move-object v0, v1
|
|
|
|
:cond_2
|
|
return-object v0
|
|
|
|
:cond_3
|
|
if-eqz v1, :cond_4
|
|
|
|
move-object v0, v1
|
|
|
|
:cond_4
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private getLastKnownLocationForProvider(Ljava/lang/String;)Landroid/location/Location;
|
|
.locals 1
|
|
.annotation build Landroidx/annotation/RequiresPermission;
|
|
anyOf = {
|
|
"android.permission.ACCESS_COARSE_LOCATION",
|
|
"android.permission.ACCESS_FINE_LOCATION"
|
|
}
|
|
.end annotation
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Landroidx/appcompat/app/TwilightManager;->mLocationManager:Landroid/location/LocationManager;
|
|
|
|
.line 134
|
|
invoke-virtual {v0, p1}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Landroidx/appcompat/app/TwilightManager;->mLocationManager:Landroid/location/LocationManager;
|
|
|
|
.line 135
|
|
invoke-virtual {v0, p1}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p1
|
|
|
|
:catch_0
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method private isStateValid()Z
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Landroidx/appcompat/app/TwilightManager;->mTwilightState:Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
|
|
.line 144
|
|
iget-wide v0, v0, Landroidx/appcompat/app/TwilightManager$TwilightState;->nextUpdate:J
|
|
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
cmp-long v0, v0, v2
|
|
|
|
if-lez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public static setInstance(Landroidx/appcompat/app/TwilightManager;)V
|
|
.locals 0
|
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
|
.end annotation
|
|
|
|
sput-object p0, Landroidx/appcompat/app/TwilightManager;->sInstance:Landroidx/appcompat/app/TwilightManager;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private updateState(Landroid/location/Location;)V
|
|
.locals 19
|
|
.param p1 # Landroid/location/Location;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
move-object/from16 v0, p0
|
|
|
|
iget-object v1, v0, Landroidx/appcompat/app/TwilightManager;->mTwilightState:Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
|
|
.line 149
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v9
|
|
|
|
.line 150
|
|
invoke-static {}, Landroidx/appcompat/app/TwilightCalculator;->getInstance()Landroidx/appcompat/app/TwilightCalculator;
|
|
|
|
move-result-object v11
|
|
|
|
const-wide/32 v12, 0x5265c00
|
|
|
|
sub-long v3, v9, v12
|
|
|
|
.line 154
|
|
invoke-virtual/range {p1 .. p1}, Landroid/location/Location;->getLatitude()D
|
|
|
|
move-result-wide v5
|
|
|
|
invoke-virtual/range {p1 .. p1}, Landroid/location/Location;->getLongitude()D
|
|
|
|
move-result-wide v7
|
|
|
|
move-object v2, v11
|
|
|
|
.line 153
|
|
invoke-virtual/range {v2 .. v8}, Landroidx/appcompat/app/TwilightCalculator;->calculateTwilight(JDD)V
|
|
|
|
.line 157
|
|
invoke-virtual/range {p1 .. p1}, Landroid/location/Location;->getLatitude()D
|
|
|
|
move-result-wide v5
|
|
|
|
invoke-virtual/range {p1 .. p1}, Landroid/location/Location;->getLongitude()D
|
|
|
|
move-result-wide v7
|
|
|
|
move-wide v3, v9
|
|
|
|
invoke-virtual/range {v2 .. v8}, Landroidx/appcompat/app/TwilightCalculator;->calculateTwilight(JDD)V
|
|
|
|
.line 158
|
|
iget v2, v11, Landroidx/appcompat/app/TwilightCalculator;->state:I
|
|
|
|
const/4 v3, 0x1
|
|
|
|
if-ne v2, v3, :cond_0
|
|
|
|
:goto_0
|
|
move v14, v3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
const/4 v3, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
.line 159
|
|
:goto_1
|
|
iget-wide v7, v11, Landroidx/appcompat/app/TwilightCalculator;->sunrise:J
|
|
|
|
.line 160
|
|
iget-wide v5, v11, Landroidx/appcompat/app/TwilightCalculator;->sunset:J
|
|
|
|
add-long v3, v9, v12
|
|
|
|
.line 164
|
|
invoke-virtual/range {p1 .. p1}, Landroid/location/Location;->getLatitude()D
|
|
|
|
move-result-wide v12
|
|
|
|
invoke-virtual/range {p1 .. p1}, Landroid/location/Location;->getLongitude()D
|
|
|
|
move-result-wide v15
|
|
|
|
move-object v2, v11
|
|
|
|
move-wide/from16 v17, v5
|
|
|
|
move-wide v5, v12
|
|
|
|
move-wide v12, v7
|
|
|
|
move-wide v7, v15
|
|
|
|
.line 163
|
|
invoke-virtual/range {v2 .. v8}, Landroidx/appcompat/app/TwilightCalculator;->calculateTwilight(JDD)V
|
|
|
|
.line 165
|
|
iget-wide v7, v11, Landroidx/appcompat/app/TwilightCalculator;->sunrise:J
|
|
|
|
const-wide/16 v2, -0x1
|
|
|
|
cmp-long v4, v12, v2
|
|
|
|
if-eqz v4, :cond_4
|
|
|
|
cmp-long v2, v17, v2
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
goto :goto_3
|
|
|
|
:cond_1
|
|
cmp-long v2, v9, v17
|
|
|
|
if-lez v2, :cond_2
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
cmp-long v2, v9, v12
|
|
|
|
if-lez v2, :cond_3
|
|
|
|
move-wide/from16 v7, v17
|
|
|
|
goto :goto_2
|
|
|
|
:cond_3
|
|
move-wide v7, v12
|
|
|
|
:goto_2
|
|
const-wide/32 v2, 0xea60
|
|
|
|
add-long/2addr v7, v2
|
|
|
|
goto :goto_4
|
|
|
|
:cond_4
|
|
:goto_3
|
|
const-wide/32 v2, 0x2932e00
|
|
|
|
add-long v7, v9, v2
|
|
|
|
.line 185
|
|
:goto_4
|
|
iput-boolean v14, v1, Landroidx/appcompat/app/TwilightManager$TwilightState;->isNight:Z
|
|
|
|
.line 186
|
|
iput-wide v7, v1, Landroidx/appcompat/app/TwilightManager$TwilightState;->nextUpdate:J
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public isNight()Z
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Landroidx/appcompat/app/TwilightManager;->mTwilightState:Landroidx/appcompat/app/TwilightManager$TwilightState;
|
|
|
|
.line 82
|
|
invoke-direct {p0}, Landroidx/appcompat/app/TwilightManager;->isStateValid()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
.line 84
|
|
iget-boolean v0, v0, Landroidx/appcompat/app/TwilightManager$TwilightState;->isNight:Z
|
|
|
|
return v0
|
|
|
|
.line 88
|
|
:cond_0
|
|
invoke-direct {p0}, Landroidx/appcompat/app/TwilightManager;->getLastKnownLocation()Landroid/location/Location;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
.line 90
|
|
invoke-direct {p0, v1}, Landroidx/appcompat/app/TwilightManager;->updateState(Landroid/location/Location;)V
|
|
|
|
.line 91
|
|
iget-boolean v0, v0, Landroidx/appcompat/app/TwilightManager$TwilightState;->isNight:Z
|
|
|
|
return v0
|
|
|
|
.line 100
|
|
:cond_1
|
|
invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;
|
|
|
|
move-result-object v0
|
|
|
|
const/16 v1, 0xb
|
|
|
|
.line 101
|
|
invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x6
|
|
|
|
if-lt v0, v1, :cond_3
|
|
|
|
const/16 v1, 0x16
|
|
|
|
if-lt v0, v1, :cond_2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
const/4 v0, 0x0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
:goto_0
|
|
const/4 v0, 0x1
|
|
|
|
:goto_1
|
|
return v0
|
|
.end method
|